Package 

Class ExtendedFile

  • All Implemented Interfaces:
    java.io.Serializable , java.lang.Comparable

    
    public abstract class ExtendedFile
    extends File
                        

    File API with extended features.

    The goal of this class is to extend missing features in the File API that are available in the NIO package but not possible to be re-implemented without low-level file system access. For instance, detecting file types other than regular files and directories, handling and creating hard links and symbolic links.

    Another goal of this class is to provide a generalized API interface for custom file system backends. The library includes backends for accessing files locally, accessing files remotely via IPC, and accessing files through shell commands (by using {@code SuFile}, included in the {@code io} module). The developer can get instances of this class with getFile.

    Implementations of this class is required to return the same type of ExtendedFile in all of its APIs returning Files. This means that, for example, if the developer is getting a list of files in a directory using a remote file system with listFiles, all files returned in the array will also be using the same remote file system backend.

    • Method Summary

      Modifier and Type Method Description
      abstract boolean isBlock()
      abstract boolean isCharacter()
      abstract boolean isSymlink()
      abstract boolean isNamedPipe()
      abstract boolean isSocket()
      abstract boolean createNewLink(String existing) Creates a new hard link named by this abstract pathname of an existing fileif and only if a file with this name does not yet exist.
      abstract boolean createNewSymlink(String target) Creates a new symbolic link named by this abstract pathname to a target fileif and only if a file with this name does not yet exist.
      abstract InputStream newInputStream() Opens an InputStream with the matching file system backend of the file.
      final OutputStream newOutputStream() Opens an OutputStream with the matching file system backend of the file.
      abstract OutputStream newOutputStream(boolean append) Opens an OutputStream with the matching file system backend of the file.
      abstract ExtendedFile getChildFile(String child) Create a child relative to the abstract pathname using the same file system backend.
      abstract ExtendedFile getAbsoluteFile()
      abstract ExtendedFile getCanonicalFile()
      abstract ExtendedFile getParentFile()
      abstract Array<ExtendedFile> listFiles()
      abstract Array<ExtendedFile> listFiles(@Nullable() FilenameFilter filter)
      abstract Array<ExtendedFile> listFiles(@Nullable() FileFilter filter)
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setLastModified, setReadOnly, setReadable, setWritable, toPath, toString, toURI, toURL
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait