public class FileSource extends AbstractFileInfo implements InfoSource
AbstractFileInfo.Options| Modifier and Type | Field and Description |
|---|---|
static FileFilter |
FILES_ONLY
A simple filter for files.
|
asStringOpt, errors, file, url| Constructor and Description |
|---|
FileSource(File file)
Creates a new file source from an existing File object.
|
FileSource(File file,
boolean doValidate)
Creates a new file source from an existing File object with optional validation.
|
FileSource(File file,
String setRoot)
Creates a new file source object from an existing File object with a set-as-root directory.
|
FileSource(String fileName)
Creates a new file source from a file name.
|
FileSource(String fileName,
InfoLocationOptions option)
Creates a new file source from a file name with options.
|
FileSource(String directory,
String fileName)
Creates a new file source from a path and a file name.
|
FileSource(String directory,
String fileName,
InfoLocationOptions option)
Creates a new file source from a path and a file name with options.
|
| Modifier and Type | Method and Description |
|---|---|
String |
asString()
Returns a string representation of the source for messages.
|
IsErrorSetFT |
getInitError()
Returns any error that happened during initialization (and relate validation) of the source.
|
Object |
getSource()
Returns the actual source.
|
protected ValidationOptions |
valOption()
Returns the validation option which makes this abstract implementation a info object or target or both.
|
asFile, asURL, getAbsoluteName, getAbsolutePath, getBaseFileName, getFileExtension, getFullFileName, getRootPath, getSetRootName, getSetRootPath, init, isValid, reset, setAsStringOption, testFile, toString, tryFS, tryResourceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisValidpublic static final FileFilter FILES_ONLY
public FileSource(File file, boolean doValidate)
file - existing file objectdoValidate - true if internal validation is required, false otherwise (for instance if the file object comes from another loader).
If validation is set to false and the input argument for file is not valid, the behavior of this object and anyone using it is unpredictable.
If validation is set to false a null validation and a validation of the getURI method of the file is still run by the constructor.public FileSource(File file, String setRoot)
file - existing file objectsetRoot - set-as-root directorypublic FileSource(File file)
file - existing file objectpublic FileSource(String fileName)
fileName - name of the file.
The file name must include a path that is accessible.
The file name must include path information if it is not in the root path.
Path information can be relative to any path in the class path.public FileSource(String fileName, InfoLocationOptions option)
fileName - name of the file.
The file name must include a path that is accessible.
The file name must include path information if it is not in the root path.
Path information can be relative to any path in the class path.option - an option on how to locate the filepublic FileSource(String directory, String fileName)
directory - a directory in which the file can be found. The directory can be absolute or relative to any directory in the class path.fileName - the file name to locatepublic FileSource(String directory, String fileName, InfoLocationOptions option)
directory - directory a directory in which the file can be found. The directory can be absolute or relative to any directory in the class path.fileName - the file name to locateoption - an option on how to locate the filepublic Object getSource()
InfoSourcegetSource in interface InfoSourcepublic IsErrorSetFT getInitError()
InfoSourcegetInitError in interface InfoSourceprotected ValidationOptions valOption()
AbstractFileInfovalOption in class AbstractFileInfopublic String asString()
InfoSourceasString in interface InfoSourceCopyright © 2010–2017. All rights reserved.