Package adams.core.io

Class FtpFileObject

    • Field Detail

      • m_Client

        protected org.apache.commons.net.ftp.FTPClient m_Client
        the FTP client object.
      • m_ParentDir

        protected String m_ParentDir
        the parent directory.
      • m_File

        protected transient org.apache.commons.net.ftp.FTPFile m_File
        the underlying file.
    • Constructor Detail

      • FtpFileObject

        public FtpFileObject​(String parentDir,
                             org.apache.commons.net.ftp.FTPFile file,
                             org.apache.commons.net.ftp.FTPClient client)
        Initializes the wrapper.
        Parameters:
        parentDir - the parent directory
        file - the file/dir to wrap
        client - the client
    • Method Detail

      • getClient

        public org.apache.commons.net.ftp.FTPClient getClient()
        Returns the client.
        Returns:
        the client
      • getParentDir

        public String getParentDir()
        Returns the parent directory.
        Returns:
        the parent
      • getFile

        public File getFile()
        Returns the wrapped file.
        Specified by:
        getFile in interface FileObject
        Returns:
        the file
      • getActualFile

        public File getActualFile()
        Returns the actual target (if possible) in case of a link.
        Specified by:
        getActualFile in interface FileObject
        Returns:
        the actual file
      • getName

        public String getName()
        Returns the file name.
        Specified by:
        getName in interface FileObject
        Returns:
        the name
      • getLength

        public long getLength()
        Returns the size of the file.
        Specified by:
        getLength in interface FileObject
        Returns:
        the size
      • isDirectory

        public boolean isDirectory()
        Returns whether the file represents a directory.
        Specified by:
        isDirectory in interface FileObject
        Returns:
        true if directory
      • getLastModified

        public Date getLastModified()
        Returns the date when the file was last modified.
        Specified by:
        getLastModified in interface FileObject
        Returns:
        date when last modified
      • isHidden

        public boolean isHidden()
        Returns whether the file is hidden.
        Specified by:
        isHidden in interface FileObject
        Returns:
        true if hidden
      • isLink

        public boolean isLink()
        Returns whether the file represents a link.
        Specified by:
        isLink in interface FileObject
        Returns:
        true if link
      • isLocal

        public boolean isLocal()
        Returns whether the file is a local file.
        Specified by:
        isLocal in interface FileObject
        Returns:
        true if local
      • compareTo

        public int compareTo​(FileObject o)
        Returns whether this file object is the same as the provided one.
        Specified by:
        compareTo in interface Comparable<FileObject>
        Parameters:
        o - the file object to compare against
        Returns:
        less than zero, equal to zero, greater than zero if this file object is less than, equal to, or greater than the other file object
      • equals

        public boolean equals​(Object obj)
        Checks whether this object is the same as the provided one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare against
        Returns:
        true if the same
        See Also:
        compareTo(FileObject)