Class RelativeToDirectory


public class RelativeToDirectory extends FileNamerIndependent
Constructs a name by finding the relative-path between the file and the input-directory.

If no input-directory exists, a name cannot be constructed.

Any directory seperator in the he path is always expressed with forward-slashes, even if backslashes are used by the operating system.

Author:
Owen Feehan
  • Constructor Details

    • RelativeToDirectory

      public RelativeToDirectory()
  • Method Details

    • deriveName

      protected String deriveName(File file, Optional<Path> inputDirectory, int index) throws CreateException
      Description copied from class: FileNamerIndependent
      Derives a unique name for this file.
      Specified by:
      deriveName in class FileNamerIndependent
      Parameters:
      file - the file.
      inputDirectory - the root input-directory used in naming.
      index - a unique incrementing number, beginning at zero, passed to each call to this method within a collection.
      Returns:
      the derived unique name.
      Throws:
      CreateException - if unable to create the unique name.