Class DelegateFileObject<AFS extends AbstractFileSystem>

    • Method Detail

      • getDelegateFile

        public FileObject getDelegateFile()
        Get access to the delegated file.
        Returns:
        The FileObject.
        Since:
        2.0
      • attachChild

        public void attachChild​(FileName baseName,
                                FileType type)
                         throws java.lang.Exception
        Adds a child to this file.
        Parameters:
        baseName - The base FileName.
        type - The FileType.
        Throws:
        java.lang.Exception - if an error occurs.
      • setFile

        public void setFile​(FileObject file)
                     throws java.lang.Exception
        Attaches or detaches the target file.
        Parameters:
        file - The FileObject.
        Throws:
        java.lang.Exception - if an error occurs.
      • doListChildren

        protected java.lang.String[] doListChildren()
                                             throws java.lang.Exception
        Lists the children of the file.
        Specified by:
        doListChildren in class AbstractFileObject<AFS extends AbstractFileSystem>
        Returns:
        a possible empty String array if the file is a directory or null or an exception if the file is not a directory or can't be read.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetAttributes

        protected java.util.Map<java.lang.String,​java.lang.Object> doGetAttributes()
                                                                                  throws java.lang.Exception
        Returns the attributes of this file.
        Overrides:
        doGetAttributes in class AbstractFileObject<AFS extends AbstractFileSystem>
        Returns:
        The attributes of the file.
        Throws:
        java.lang.Exception - if an error occurs.
      • doSetAttribute

        protected void doSetAttribute​(java.lang.String atttrName,
                                      java.lang.Object value)
                               throws java.lang.Exception
        Sets an attribute of this file.
        Overrides:
        doSetAttribute in class AbstractFileObject<AFS extends AbstractFileSystem>
        Parameters:
        atttrName - The attribute name.
        value - The value to be associated with the attribute name.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetCertificates

        protected java.security.cert.Certificate[] doGetCertificates()
                                                              throws java.lang.Exception
        Returns the certificates of this file.
        Overrides:
        doGetCertificates in class AbstractFileObject<AFS extends AbstractFileSystem>
        Returns:
        The certificates used to sign the file.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetLastModifiedTime

        protected long doGetLastModifiedTime()
                                      throws java.lang.Exception
        Returns the last-modified time of this file.
        Overrides:
        doGetLastModifiedTime in class AbstractFileObject<AFS extends AbstractFileSystem>
        Returns:
        The last modification time.
        Throws:
        java.lang.Exception - if an error occurs.
      • doSetLastModifiedTime

        protected boolean doSetLastModifiedTime​(long modtime)
                                         throws java.lang.Exception
        Sets the last-modified time of this file.
        Overrides:
        doSetLastModifiedTime in class AbstractFileObject<AFS extends AbstractFileSystem>
        Parameters:
        modtime - The last modification time.
        Returns:
        true if the time was set.
        Throws:
        java.lang.Exception - Any Exception thrown is wrapped in FileSystemException.
        Since:
        2.0
      • doGetInputStream

        protected java.io.InputStream doGetInputStream()
                                                throws java.lang.Exception
        Creates an input stream to read the file content from.
        Specified by:
        doGetInputStream in class AbstractFileObject<AFS extends AbstractFileSystem>
        Returns:
        An InputStream to read the file content.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetOutputStream

        protected java.io.OutputStream doGetOutputStream​(boolean bAppend)
                                                  throws java.lang.Exception
        Creates an output stream to write the file content to.
        Overrides:
        doGetOutputStream in class AbstractFileObject<AFS extends AbstractFileSystem>
        Parameters:
        bAppend - true if the file should be appended to, false if it should be overwritten.
        Returns:
        An OutputStream to write to the file.
        Throws:
        java.lang.Exception - if an error occurs.
      • fileCreated

        public void fileCreated​(FileChangeEvent event)
                         throws java.lang.Exception
        Called when a file is created.
        Specified by:
        fileCreated in interface FileListener
        Parameters:
        event - The FileChangeEvent.
        Throws:
        java.lang.Exception - if an error occurs.
      • fileDeleted

        public void fileDeleted​(FileChangeEvent event)
                         throws java.lang.Exception
        Called when a file is deleted.
        Specified by:
        fileDeleted in interface FileListener
        Parameters:
        event - The FileChangeEvent.
        Throws:
        java.lang.Exception - if an error occurs.
      • fileChanged

        public void fileChanged​(FileChangeEvent event)
                         throws java.lang.Exception
        Called when a file is changed.

        This will only happen if you monitor the file using FileMonitor.

        Specified by:
        fileChanged in interface FileListener
        Parameters:
        event - The FileChangeEvent.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetContentInfo

        protected FileContentInfo doGetContentInfo()
                                            throws java.lang.Exception
        Return file content info.
        Returns:
        the file content info of the delegee.
        Throws:
        java.lang.Exception - Any thrown Exception is wrapped in FileSystemException.
        Since:
        2.0
      • doRename

        protected void doRename​(FileObject newFile)
                         throws java.lang.Exception
        Renames the file.
        Overrides:
        doRename in class AbstractFileObject<AFS extends AbstractFileSystem>
        Parameters:
        newFile - the new location/name.
        Throws:
        java.lang.Exception - Any thrown Exception is wrapped in FileSystemException.
        Since:
        2.0
      • doRemoveAttribute

        protected void doRemoveAttribute​(java.lang.String atttrName)
                                  throws java.lang.Exception
        Removes an attribute of this file.
        Overrides:
        doRemoveAttribute in class AbstractFileObject<AFS extends AbstractFileSystem>
        Parameters:
        atttrName - The name of the attribute to remove.
        Throws:
        java.lang.Exception - if an error occurs.
        Since:
        2.0