Interface FileSystem
- All Known Implementing Classes:
AbstractFileSystem
,Bzip2FileSystem
,CompressedFileFileSystem
,FtpFileSystem
,FtpsFileSystem
,GzipFileSystem
,Http4FileSystem
,Http5FileSystem
,HttpFileSystem
,JarFileSystem
,LocalFileSystem
,RamFileSystem
,SftpFileSystem
,TarFileSystem
,UrlFileSystem
,VirtualFileSystem
,ZipFileSystem
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addJunction
(String junctionPoint, FileObject targetFile) Adds a junction to this file system.void
addListener
(FileObject file, FileListener listener) Adds a listener on a file in this file system.getAttribute
(String attrName) Gets the value of an attribute of the file system.Returns a reference to the FileSystemManager.Returns the FileSystemOptions used to instantiate this file system.double
Returns the accuracy of the last modification time in milliseconds.Returns the parent layer if this is a layered file system.getRoot()
Returns the root file of this file system.Returns the name of the root file of this file system.The root URI passed as a file system option or obtained from the rootName.boolean
hasCapability
(Capability capability) Determines if this file system has a particular capability.void
removeJunction
(String junctionPoint) Removes a junction from this file system.void
removeListener
(FileObject file, FileListener listener) Removes a listener from a file in this file system.replicateFile
(FileObject file, FileSelector selector) Creates a temporary local copy of a file and its descendants.resolveFile
(String name) Finds a file in this file system.resolveFile
(FileName name) Finds a file in this file system.void
setAttribute
(String attrName, Object value) Sets the value of an attribute of the file's content.
-
Method Details
-
addJunction
Adds a junction to this file system. A junction is a link that attaches the supplied file to a point in this file system, making it look like part of the file system.- Parameters:
junctionPoint
- The point in this file system to add the junction.targetFile
- The file to link to.- Throws:
FileSystemException
- If this file system does not support junctions, or the junction point or target file is invalid (the file system may not support nested junctions, for example).
-
addListener
Adds a listener on a file in this file system.- Parameters:
file
- The file to attach the listener to.listener
- The listener to add.
-
getAttribute
Gets the value of an attribute of the file system.TODO - change to
Map getAttributes()
instead?TODO - define the standard attribute names, and define which attrs are guaranteed to be present.
- Parameters:
attrName
- The name of the attribute.- Returns:
- The value of the attribute.
- Throws:
FileSystemException
- If the file does not exist, or is being written, or if the attribute is unknown.- See Also:
-
getFileSystemManager
Returns a reference to the FileSystemManager.- Returns:
- The FileSystemManager.
-
getFileSystemOptions
Returns the FileSystemOptions used to instantiate this file system.- Returns:
- The FileSystemOptions.
-
getLastModTimeAccuracy
double getLastModTimeAccuracy()Returns the accuracy of the last modification time in milliseconds.The local file provider is not very smart in figuring this out, for remote access to file systems the providers typically don't know the value of the underlying real file system.
- Returns:
- the accuracy of the last modification time in milliseconds. A value of 0 means perfectly accurate, anything > 0 might be off by this value. For example, sftp has an accuracy of 1000 milliseconds.
-
getParentLayer
Returns the parent layer if this is a layered file system.- Returns:
- The parent layer, or null if this is not a layered file system.
- Throws:
FileSystemException
- if an error occurs.
-
getRoot
Returns the root file of this file system.- Returns:
- The root FileObject.
- Throws:
FileSystemException
- if an error occurs.
-
getRootName
Returns the name of the root file of this file system. The root name always contains a path String of "/".- Returns:
- the root FileName.
-
getRootURI
The root URI passed as a file system option or obtained from the rootName.- Returns:
- The root URI.
-
hasCapability
Determines if this file system has a particular capability.TODO - Move this to another interface, so that set of capabilities can be queried.
- Parameters:
capability
- The capability to check for.- Returns:
- true if this file system has the requested capability. Note that not all files in the file system may have the capability.
-
removeJunction
Removes a junction from this file system.- Parameters:
junctionPoint
- The junction to remove.- Throws:
FileSystemException
- On error removing the junction.
-
removeListener
Removes a listener from a file in this file system.- Parameters:
file
- The file to remove the listener from.listener
- The listener to remove.
-
replicateFile
Creates a temporary local copy of a file and its descendants. If this file is already a local file, a copy is not made.Note that the local copy may include additional files, that were not selected by the given selector.
TODO - Add options to indicate whether the caller is happy to deal with extra files being present locally (eg if the file has been replicated previously), or whether the caller expects only the selected files to be present.
- Parameters:
file
- The file to replicate.selector
- The selector to use to select the files to replicate.- Returns:
- The local copy of this file.
- Throws:
FileSystemException
- If this file does not exist, or on error replicating the file.
-
resolveFile
Finds a file in this file system.- Parameters:
name
- The name of the file.- Returns:
- The file. Never returns null.
- Throws:
FileSystemException
- if an error occurs.
-
resolveFile
Finds a file in this file system.- Parameters:
name
- The name of the file. This must be an absolute path.- Returns:
- The file. Never returns null.
- Throws:
FileSystemException
- if an error occurs.
-
setAttribute
Sets the value of an attribute of the file's content. Creates the file if it does not exist.- Parameters:
attrName
- The name of the attribute.value
- The value of the attribute.- Throws:
FileSystemException
- If the file is read-only, or is being read, or if the attribute is not supported, or on error setting the attribute.- See Also:
-