Class LocalFileSystem

    • Method Detail

      • getSubFileSystem

        public LocalFileSystemSub getSubFileSystem​(FSRL fsrl)
                                            throws java.io.IOException
        Creates a new file system instance that is a sub-view limited to the specified directory.
        Parameters:
        fsrl - FSRL that must be a directory in this local filesystem
        Returns:
        new LocalFileSystemSub instance
        Throws:
        java.io.IOException - if bad FSRL
      • isLocalSubdir

        public boolean isLocalSubdir​(FSRL fsrl)
        Returns true if the FSRL is a local filesystem subdirectory.
        Parameters:
        fsrl - FSRL to test.
        Returns:
        boolean true if local filesystem directory.
      • getLocalFile

        public java.io.File getLocalFile​(FSRL fsrl)
                                  throws java.io.IOException
        Convert a FSRL that points to this file system into a java File.
        Parameters:
        fsrl - FSRL
        Returns:
        File
        Throws:
        java.io.IOException - if FSRL does not point to this file system
      • getLocalFSRL

        public FSRL getLocalFSRL​(java.io.File f)
        Converts a File into a FSRL.
        Parameters:
        f - File
        Returns:
        FSRL
      • getName

        public java.lang.String getName()
        Description copied from interface: GFileSystem
        File system volume name.

        Typically the name of the container file, or a internally stored 'volume' name.

        Specified by:
        getName in interface GFileSystem
        Returns:
        string filesystem volume name.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • isStatic

        public boolean isStatic()
        Description copied from interface: GFileSystem
        Indicates if this filesystem is a static snapshot or changes.
        Specified by:
        isStatic in interface GFileSystem
        Returns:
        boolean true if the filesystem is static or false if dynamic content.
      • getListing

        public java.util.List<GFile> getListing​(GFile directory)
        Description copied from interface: GFileSystem
        Returns a list of files that reside in the specified directory on this filesystem.

        Specified by:
        getListing in interface GFileSystem
        Parameters:
        directory - NULL means root of filesystem.
        Returns:
        List of GFile instances of file in the requested directory.
      • getFileAttributes

        public FileAttributes getFileAttributes​(java.io.File f)
        Create a FileAttributes container with info about the specified local file.
        Parameters:
        f - File to query
        Returns:
        FileAttributes instance
      • lookup

        public GFileImpl lookup​(java.lang.String path)
                         throws java.io.IOException
        Description copied from interface: GFileSystem
        Retrieves a GFile from this filesystem based on its full path and filename.

        Specified by:
        lookup in interface GFileSystem
        Parameters:
        path - string path and filename of a file located in this filesystem. Use null or "/" to retrieve the root directory
        Returns:
        GFile instance of requested file, null if not found.
        Throws:
        java.io.IOException - if IO error when looking up file.
      • isClosed

        public boolean isClosed()
        Description copied from interface: GFileSystem
        Returns true if the filesystem has been closed
        Specified by:
        isClosed in interface GFileSystem
        Returns:
        boolean true if the filesystem has been closed.
      • getInputStream

        public java.io.InputStream getInputStream​(GFile file,
                                                  TaskMonitor monitor)
                                           throws java.io.IOException
        Description copied from interface: GFileSystem
        Returns an InputStream that contains the contents of the specified GFile.

        The caller is responsible for closing the stream.

        Specified by:
        getInputStream in interface GFileSystem
        Parameters:
        file - GFile to get an InputStream for
        monitor - TaskMonitor to watch and update progress
        Returns:
        new InputStream contains the contents of the file or NULL if the file doesn't have data.
        Throws:
        java.io.IOException - if IO problem
      • getByteProvider

        public ByteProvider getByteProvider​(GFile file,
                                            TaskMonitor monitor)
                                     throws java.io.IOException
        Description copied from interface: GFileSystem
        Returns a ByteProvider that contains the contents of the specified GFile.

        The caller is responsible for closing the provider.

        Specified by:
        getByteProvider in interface GFileSystem
        Parameters:
        file - GFile to get bytes for
        monitor - TaskMonitor to watch and update progress
        Returns:
        new ByteProvider that contains the contents of the file, or NULL if file doesn't have data
        Throws:
        java.io.IOException - if error
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getMD5Hash

        public java.lang.String getMD5Hash​(GFile file,
                                           boolean required,
                                           TaskMonitor monitor)
                                    throws CancelledException,
                                           java.io.IOException
        Description copied from interface: GFileHashProvider
        Returns the MD5 hash of the specified file.
        Specified by:
        getMD5Hash in interface GFileHashProvider
        Parameters:
        file - the GFile
        required - boolean flag, if true the hash will always be returned, even if it has to be calculated. If false, the hash will be returned if easily available
        monitor - TaskMonitor
        Returns:
        MD5 hash as a string
        Throws:
        CancelledException - if cancelled
        java.io.IOException - if error