`
weitao1026
  • 浏览: 1043507 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Class FTPFile

 
阅读更多
<!-- ========= END OF TOP NAVBAR ========= -->

<!-- ======== START OF CLASS DATA ======== -->
org.apache.commons.net.ftp

Class FTPFile

  • <!-- =========== FIELD SUMMARY =========== -->
    • <!-- -->

      Field Summary

      Fields  Modifier and Type Field and Description
      static int DIRECTORY_TYPE
      A constant indicating an FTPFile is a directory.
      static int EXECUTE_PERMISSION
      A constant indicating file execute permission or directory listing permission.
      static int FILE_TYPE
      A constant indicating an FTPFile is a file.
      static int GROUP_ACCESS
      A constant indicating group access permissions.
      static int READ_PERMISSION
      A constant indicating file/directory read permission.
      static int SYMBOLIC_LINK_TYPE
      A constant indicating an FTPFile is a symbolic link.
      static int UNKNOWN_TYPE
      A constant indicating an FTPFile is of unknown type.
      static int USER_ACCESS
      A constant indicating user access permissions.
      static int WORLD_ACCESS
      A constant indicating world access permissions.
      static int WRITE_PERMISSION
      A constant indicating file/directory write permission.
    <!-- ======== CONSTRUCTOR SUMMARY ======== -->
    • <!-- -->

      Constructor Summary

      Constructors Constructor and Description
      FTPFile()
      Creates an empty FTPFile.
    <!-- ========== METHOD SUMMARY =========== -->
    • <!-- -->

      Method Summary

      Methods  Modifier and Type Method and Description
      String getGroup()
      Returns the name of the group owning the file.
      int getHardLinkCount()
      Return the number of hard links to this file.
      String getLink()
      If the FTPFile is a symbolic link, this method returns the name of the file being pointed to by the symbolic link.
      String getName()
      Return the name of the file.
      String getRawListing()
      Get the original FTP server raw listing used to initialize the FTPFile.
      long getSize()
      Return the file size in bytes.
      Calendar getTimestamp()
      Returns the file timestamp.
      int getType()
      Return the type of the file (one of the _TYPE constants), e.g., if it is a directory, a regular file, or a symbolic link.
      String getUser()
      Returns the name of the user owning the file.
      boolean hasPermission(int access,                          int permission)
      Determines if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
      boolean isDirectory()
      Determine if the file is a directory.
      boolean isFile()
      Determine if the file is a regular file.
      boolean isSymbolicLink()
      Determine if the file is a symbolic link.
      boolean isUnknown()
      Determine if the type of the file is unknown.
      boolean isValid()
      Used to indicate whether an entry is valid or not.
      void setGroup(String group)
      Set the name of the group owning the file.
      void setHardLinkCount(int links)
      Set the number of hard links to this file.
      void setLink(String link)
      If the FTPFile is a symbolic link, use this method to set the name of the file being pointed to by the symbolic link.
      void setName(String name)
      Set the name of the file.
      void setPermission(int access,                          int permission,                          boolean value)
      Set if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
      void setRawListing(String rawListing)
      Set the original FTP server raw listing from which the FTPFile was created.
      void setSize(long size)
      Set the file size in bytes.
      void setTimestamp(Calendar date)
      Set the file timestamp.
      void setType(int type)
      Set the type of the file (DIRECTORY_TYPE, FILE_TYPE, etc.).
      void setUser(String user)
      Set the name of the user owning the file.
      String toFormattedString()
      Returns a string representation of the FTPFile information.
      String toFormattedString(String timezone)
      Returns a string representation of the FTPFile information.
      String toString()
      Returns a string representation of the FTPFile information.
  • <!-- ============ FIELD DETAIL =========== --> <!-- ========= CONSTRUCTOR DETAIL ======== -->
    • <!-- -->

      Constructor Detail

      <!-- -->
      • FTPFile

        public FTPFile()
        Creates an empty FTPFile.
    <!-- ============ METHOD DETAIL ========== -->
    • <!-- -->

      Method Detail

      <!-- -->
      • setRawListing

        public void setRawListing(String rawListing)
        Set the original FTP server raw listing from which the FTPFile was created.
        Parameters:
        rawListing - The raw FTP server listing.
      <!-- -->
      • getRawListing

        public String getRawListing()
        Get the original FTP server raw listing used to initialize the FTPFile.
        Returns:
        The original FTP server raw listing used to initialize the FTPFile.
      <!-- -->
      • isDirectory

        public boolean isDirectory()
        Determine if the file is a directory.
        Returns:
        True if the file is of type DIRECTORY_TYPE, false if not.
      <!-- -->
      • isFile

        public boolean isFile()
        Determine if the file is a regular file.
        Returns:
        True if the file is of type FILE_TYPE, false if not.
      <!-- -->
      • isSymbolicLink

        public boolean isSymbolicLink()
        Determine if the file is a symbolic link.
        Returns:
        True if the file is of type UNKNOWN_TYPE, false if not.
      <!-- -->
      • isUnknown

        public boolean isUnknown()
        Determine if the type of the file is unknown.
        Returns:
        True if the file is of type UNKNOWN_TYPE, false if not.
      <!-- -->
      • isValid

        public boolean isValid()
        Used to indicate whether an entry is valid or not. If the entry is invalid, only the getRawListing() method will be useful. Other methods may fail. Used in conjunction with list parsing that preseverves entries that failed to parse.
        Returns:
        true if the entry is valid
        Since:
        3.4
        See Also:
        FTPClientConfig.setUnparseableEntries(boolean)
      <!-- -->
      • setType

        public void setType(int type)
        Set the type of the file (DIRECTORY_TYPE, FILE_TYPE, etc.).
        Parameters:
        type - The integer code representing the type of the file.
      <!-- -->
      • getType

        public int getType()
        Return the type of the file (one of the _TYPE constants), e.g., if it is a directory, a regular file, or a symbolic link.
        Returns:
        The type of the file.
      <!-- -->
      • setName

        public void setName(String name)
        Set the name of the file.
        Parameters:
        name - The name of the file.
      <!-- -->
      • getName

        public String getName()
        Return the name of the file.
        Returns:
        The name of the file.
      <!-- -->
      • setSize

        public void setSize(long size)
        Set the file size in bytes.
        Parameters:
        size - The file size in bytes.
      <!-- -->
      • getSize

        public long getSize()
        Return the file size in bytes.
        Returns:
        The file size in bytes.
      <!-- -->
      • setHardLinkCount

        public void setHardLinkCount(int links)
        Set the number of hard links to this file. This is not to be confused with symbolic links.
        Parameters:
        links - The number of hard links to this file.
      <!-- -->
      • getHardLinkCount

        public int getHardLinkCount()
        Return the number of hard links to this file. This is not to be confused with symbolic links.
        Returns:
        The number of hard links to this file.
      <!-- -->
      • setGroup

        public void setGroup(String group)
        Set the name of the group owning the file. This may be a string representation of the group number.
        Parameters:
        group - The name of the group owning the file.
      <!-- -->
      • getGroup

        public String getGroup()
        Returns the name of the group owning the file. Sometimes this will be a string representation of the group number.
        Returns:
        The name of the group owning the file.
      <!-- -->
      • setUser

        public void setUser(String user)
        Set the name of the user owning the file. This may be a string representation of the user number;
        Parameters:
        user - The name of the user owning the file.
      <!-- -->
      • getUser

        public String getUser()
        Returns the name of the user owning the file. Sometimes this will be a string representation of the user number.
        Returns:
        The name of the user owning the file.
      <!-- -->
      • setLink

        public void setLink(String link)
        If the FTPFile is a symbolic link, use this method to set the name of the file being pointed to by the symbolic link.
        Parameters:
        link - The file pointed to by the symbolic link.
      <!-- -->
      • getLink

        public String getLink()
        If the FTPFile is a symbolic link, this method returns the name of the file being pointed to by the symbolic link. Otherwise it returns null.
        Returns:
        The file pointed to by the symbolic link (null if the FTPFile is not a symbolic link).
      <!-- -->
      • setTimestamp

        public void setTimestamp(Calendar date)
        Set the file timestamp. This usually the last modification time. The parameter is not cloned, so do not alter its value after calling this method.
        Parameters:
        date - A Calendar instance representing the file timestamp.
      <!-- -->
      • getTimestamp

        public Calendar getTimestamp()
        Returns the file timestamp. This usually the last modification time.
        Returns:
        A Calendar instance representing the file timestamp.
      <!-- -->
      • setPermission

        public void setPermission(int access,
                         int permission,
                         boolean value)
        Set if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
        Parameters:
        access - The access group (one of the _ACCESS constants)
        permission - The access permission (one of the _PERMISSION constants)
        value - True if permission is allowed, false if not.
        Throws:
        ArrayIndexOutOfBoundsException - if either of the parameters is out of range
      <!-- -->
      • hasPermission

        public boolean hasPermission(int access,
                            int permission)
        Determines if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
        Parameters:
        access - The access group (one of the _ACCESS constants)
        permission - The access permission (one of the _PERMISSION constants)
        Returns:
        true if isValid() is true && the associated permission is set; false otherwise.
        Throws:
        ArrayIndexOutOfBoundsException - if either of the parameters is out of range
      <!-- -->
      • toString

        public String toString()
        Returns a string representation of the FTPFile information.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the FTPFile information.
      <!-- -->
      • toFormattedString

        public String toFormattedString()
        Returns a string representation of the FTPFile information. This currently mimics the Unix listing format. This method uses the timezone of the Calendar entry, which is the server time zone (if one was provided) otherwise it is the local time zone.

        Note: if the instance is not valid isValid(), no useful information can be returned. In this case, use getRawListing() instead.

        Returns:
        A string representation of the FTPFile information.
        Since:
        3.0
      <!-- -->
      • toFormattedString

        public String toFormattedString(String timezone)
        Returns a string representation of the FTPFile information. This currently mimics the Unix listing format. This method allows the Calendar time zone to be overridden.

        Note: if the instance is not valid isValid(), no useful information can be returned. In this case, use getRawListing() instead.

        Parameters:
        timezone - the timezone to use for displaying the time stamp If null, then use the Calendar entry timezone
        Returns:
        A string representation of the FTPFile information.
        Since:
        3.4
分享到:
评论

相关推荐

    ftpFile及ftpServer使用说明改

    ### FTPServer与FTPFile在文件传输中的应用 #### FTPServer简介 FTPServer是指提供文件传输服务的服务器软件,主要用于在网络环境中实现文件的上传、下载等功能。FTP(File Transfer Protocol)是一种用于在网络上...

    ftpFile及ftpServer使用说明

    ### FTPFile及FTP Server 使用说明 #### 一、FTP简介 FTP(File Transfer Protocol)是一种用于在网络上进行文件传输的标准协议。它允许用户将文件从一台计算机传输到另一台计算机上,并支持基本的文件管理操作,如...

    ftp_class.zip_class_ftp_ftp_php ftp_php_ftp_class_php上传下载

    FTP(File Transfer Protocol)是一种用于在网络上进行文件传输的标准协议,广泛应用于网站的文件上传和下载。在PHP中,我们可以利用内置的ftp扩展来实现FTP功能,这个扩展提供了一系列的函数来处理FTP连接、文件...

    Ftp_class

    标题"Ftp_class"所指的是一个基于PHP编写的FTP(File Transfer Protocol)上传类。FTP是一种网络协议,用于在计算机之间进行文件传输。这个类库包含了处理FTP连接、上传、下载等任务所需的功能,使得开发者能够方便...

    FTP-springboot.zip

    public FtpTemplate ftpTemplate(SessionFactory&lt;FTPFile&gt; sessionFactory) { return new FtpTemplate(sessionFactory); } } ``` 有了这些配置,我们就可以编写业务逻辑来实现文件上传和下载功能。例如,我们...

    WinInet_FTP_Class.zip_FtpEx_ftp

    【WinInet_FTP_Class.zip_FtpEx_ftp】是一个包含FTP客户端实现的代码压缩包,主要用于使用WinInet库进行FTP(File Transfer Protocol)文件传输。FTP是一种用于在网络上进行文件传输的标准协议,广泛应用于网站内容...

    Helper Master

    Public class FileValidation 图片检测类 Public class FormulaHelper 数学函数帮助类 Public class FTPClient Ftp客户端相关类 Public class FTPHelper Ftp帮助类 Public class GridViewExport GridView导出...

    ftp需要的jar 包

    这个jar包包含了所有执行FTP操作所需的类和方法,如`FTPClient`、`FTPFile`等。使用这个库,开发者可以方便地创建FTP连接,进行被动模式或主动模式的数据传输,管理文件权限,处理断点续传等复杂场景。 以下是一个...

    java定时从ftp服务器更新相关文件

    private static boolean needToUpdate(FTPFile file) { // 这里应该添加实际的逻辑,比较本地文件和FTP文件的修改时间 return true; // 临时返回值,实际应根据时间判断 } } ``` 在这个示例中,我们首先连接到...

    FTP JAVA工具类(连接FTP,上传文件到FTP,删除FTP文件,下载FTP文件,检索FTP文件)

    FTP (File Transfer Protocol) 是一种用于在网络上进行文件传输的标准协议,广泛应用于Web开发、系统管理和数据备份等场景。Java作为一种跨平台的编程语言,提供了多种库来实现FTP操作,如Apache Commons Net库。本...

    JAVA操作FTP文件服务器上传与下载文件

    在Java编程中,FTP(File Transfer Protocol)文件服务器的交互是一项常见的任务,它允许程序员从或向远程服务器传输文件。本篇文章将详细讲解如何使用Java实现FTP文件的上传与下载,以及相关的操作如创建文件夹、...

    ftp4j-1.3.1下载

    FTPFile[] list = client.list("*.jpg"); //显示文件或文件夹的修改时间 java.util.Date md = client.modifiedDate("filename.ext"); //上传和下载文件 //下载服务器上remoteFile.ext 下载到本地 localFile.ext ...

    FTP.rar_class A_jftp_net sf单位

    import net.sf.jftp.net.ConnectionHandler import ...import net.sf.jftp.net.FtpConnection ... import java.io.* ...// this class download a file via anonymous ftp and shows output.

    Ftp上传PHP类

    FTP(File Transfer Protocol)是一种用于在网络上进行文件传输的标准协议,广泛应用于网站内容的发布和其他文件管理场景。在PHP中,通过FTP类可以方便地与FTP服务器交互,进行文件的上传、下载、删除等操作。 描述...

    php ftp 操作类

    $ftp-&gt;upload('/local/file.txt', '/remote/path/file.txt'); $ftp-&gt;disconnect(); ``` 总之,PHP FTP操作类是提高开发效率、简化FTP操作的有效工具。它将复杂的FTP通信封装起来,使得开发者可以更加专注于业务逻辑...

    java支持ftp下载,并简单实现过滤

    FTPFile[] files = ftp.listFiles(); for (FTPFile file : files) { if (Arrays.stream(filters).anyMatch(file.getName()::endsWith)) { // 下载符合条件的文件 } } ``` 5. **配置文件使用**:`config....

    FTP 图片上传

    FTP(File Transfer Protocol)是一种用于在互联网上进行文件传输的标准协议。在 ThinPHP 框架下实现 FTP 图片上传,通常涉及到几个关键步骤和技术点,包括 FTP 客户端库的使用、文件上传处理、配置管理以及错误处理...

    php ftp 代码下载

    在实际开发中,为了代码的健壮性和可维护性,通常会封装这些操作到一个FTP类中,如提供的`ftp_class`文件可能就是一个这样的实现。这个类可能包含构造函数来处理连接和登录,方法如`download`、`upload`、`create...

    java访问FtpSever

    例如,你可以使用`FTPClient`类建立连接,`FTPFile`类来处理服务器上的文件信息,以及`FTPReply`类检查服务器的响应代码。 以下是一个基本的Java FTP客户端操作示例: ```java import org.apache.commons.net.ftp....

Global site tag (gtag.js) - Google Analytics