Interface FileHandle
- All Superinterfaces:
CreatedDateAccessor, FileSizeAccessor, ModifiedDateAccessor, NameAccessor, PathAccessor<String>
- All Known Subinterfaces:
FileHandle.MutableFileHandle
- All Known Implementing Classes:
FileHandleImpl, FileHandleImpl.MutableFileHandleImpl
public interface FileHandle
extends PathAccessor<String>, NameAccessor, FileSizeAccessor, CreatedDateAccessor, ModifiedDateAccessor
A file (handle) (descriptor) describes a file in a file system.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe mutableFileHandleallows the modification of (fiddling around with) attributes. ------------------------------------------------------------------------- ATTENTION: Usually fiddling around with attributes is not necessary, as theFileSystemitself provides the sufficient functionality to work with files.Nested classes/interfaces inherited from interface CreatedDateAccessor
CreatedDateAccessor.CreatedDateMutator, CreatedDateAccessor.CreatedDatePropertyNested classes/interfaces inherited from interface FileSizeAccessor
FileSizeAccessor.FileSizeBuilder<B>, FileSizeAccessor.FileSizeMutator, FileSizeAccessor.FileSizePropertyNested classes/interfaces inherited from interface ModifiedDateAccessor
ModifiedDateAccessor.ModifiedDateMutator, ModifiedDateAccessor.ModifiedDatePropertyNested classes/interfaces inherited from interface NameAccessor
NameAccessor.NameBuilder<B>, NameAccessor.NameMutator, NameAccessor.NamePropertyNested classes/interfaces inherited from interface PathAccessor
PathAccessor.PathBuilder<T,B>, PathAccessor.PathMutator<T>, PathAccessor.PathProperty<T> -
Method Summary
Modifier and TypeMethodDescriptionThe date when the file was created.longThe size of the content of the file.The date when the file was modified.getName()The name is the part of the key without the path.getPath()The path is the part of the key without the name.toKey()The key is the fully qualified name to identify the file.Converts the giveFileHandleto aFileHandle.MutableFileHandle.
-
Method Details
-
getPath
String getPath()The path is the part of the key without the name. The path separator is not implementation specific and should be retrieved from the file system'sFileSystem.PATH_DELIMITERattribute.- Specified by:
getPathin interfacePathAccessor<String>- Returns:
- The path of the file's key without the name.
-
getName
String getName()The name is the part of the key without the path. The path separator is not implementation specific and should be retrieved from the file system'sFileSystem.PATH_DELIMITERattribute.- Specified by:
getNamein interfaceNameAccessor- Returns:
- The name of the file's key without the path.
-
toKey
String toKey()The key is the fully qualified name to identify the file. The key usually is physically (directory path and filename) or virtually composed of the path and the name.- Returns:
- The fully qualified key of the file.
-
getFileSize
long getFileSize()The size of the content of the file.- Specified by:
getFileSizein interfaceFileSizeAccessor- Returns:
- The content size of the file.
-
getCreatedDate
Date getCreatedDate()The date when the file was created.- Specified by:
getCreatedDatein interfaceCreatedDateAccessor- Returns:
- The creation date.
-
getModifiedDate
Date getModifiedDate()The date when the file was modified.- Specified by:
getModifiedDatein interfaceModifiedDateAccessor- Returns:
- The modification date.
-
toMutableFileHandle
FileHandle.MutableFileHandle toMutableFileHandle()Converts the giveFileHandleto aFileHandle.MutableFileHandle. The mutableFileHandleallows the modification of (fiddling around with) attributes. ------------------------------------------------------------------------- ATTENTION: Usually fiddling around with attributes is not necessary, as theFileSystemitself provides the sufficient functionality to work with files. In some cases though this might be necessary: This method is being provided to allow modification of file attributes while making sure that theFileHandleitself creates a copy so that any additional attributes provided by extensions of this interface of whom the developer does not know (yet) are preserved. So extensions of theFileHandleknow how to create aFileHandle.MutableFileHandlewithout information loss, the business logic does not require to take care of any yet unknown extensions. ------------------------------------------------------------------------- CAUTION: Working with modifiedFileHandles on theFileSystemcan aCause unexpected (severe) behavior (data loss), so we assume that you know what you do when using theFileHandle.MutableFileHandle! ------------------------------------------------------------------------- UseFileHandle.MutableFileHandle.toFileHandle()to get back to aFileHandleto avoid hassle with collections, theObject.hashCode()and theObject.equals(Object)operations.- Returns:
- the mutable file handle
-