Interface FileHandle

All Superinterfaces:
CreatedDateAccessor, FileSizeAccessor, ModifiedDateAccessor, NameAccessor, PathAccessor<String>
All Known Subinterfaces:
FileHandle.MutableFileHandle
All Known Implementing Classes:
FileHandleImpl, FileHandleImpl.MutableFileHandleImpl

A file (handle) (descriptor) describes a file in a file system.
  • 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's FileSystem.PATH_DELIMITER attribute.
      Specified by:
      getPath in interface PathAccessor<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's FileSystem.PATH_DELIMITER attribute.
      Specified by:
      getName in interface NameAccessor
      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:
      getFileSize in interface FileSizeAccessor
      Returns:
      The content size of the file.
    • getCreatedDate

      Date getCreatedDate()
      The date when the file was created.
      Specified by:
      getCreatedDate in interface CreatedDateAccessor
      Returns:
      The creation date.
    • getModifiedDate

      Date getModifiedDate()
      The date when the file was modified.
      Specified by:
      getModifiedDate in interface ModifiedDateAccessor
      Returns:
      The modification date.
    • toMutableFileHandle

      FileHandle.MutableFileHandle toMutableFileHandle()
      Converts the give FileHandle to a FileHandle.MutableFileHandle. The mutable FileHandle allows the modification of (fiddling around with) attributes. ------------------------------------------------------------------------- ATTENTION: Usually fiddling around with attributes is not necessary, as the FileSystem itself 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 the FileHandle itself 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 the FileHandle know how to create a FileHandle.MutableFileHandle without information loss, the business logic does not require to take care of any yet unknown extensions. ------------------------------------------------------------------------- CAUTION: Working with modified FileHandles on the FileSystem can aCause unexpected (severe) behavior (data loss), so we assume that you know what you do when using the FileHandle.MutableFileHandle! ------------------------------------------------------------------------- Use FileHandle.MutableFileHandle.toFileHandle() to get back to a FileHandle to avoid hassle with collections, the Object.hashCode() and the Object.equals(Object) operations.
      Returns:
      the mutable file handle