Class RelativeToDirectory
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
deriveName
(File file, Optional<Path> inputDirectory, int index) Derives a unique name for this file.Methods inherited from class org.anchoranalysis.io.input.bean.namer.FileNamerIndependent
deriveName
Methods inherited from class org.anchoranalysis.io.input.bean.namer.FileNamer
deriveName, deriveNameUnique
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
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 classFileNamerIndependent
- 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.
-