org.apache.tools.ant.taskdefs.optional.net

## Class FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile

- java.lang.Object
- - org.apache.tools.ant.taskdefs.optional.net.FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile

- Direct Known Subclasses:
    FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPRootFile
  Enclosing class:
    FTPTaskMirrorImpl.FTPDirectoryScanner

      protected class FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile
      extends java.lang.Object

  an AntFTPFile is a representation of a remote file
  Since:
    Ant 1.6

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile(org.apache.commons.net.ftp.FTPClient client, org.apache.commons.net.ftp.FTPFile ftpFile, java.lang.String curpwd)` constructor
    `FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile(FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile parent, java.lang.String path)` other constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `exists()` find out if the file exists
    `java.lang.String` | `getAbsolutePath()` find out the absolute path of the file
    `protected org.apache.commons.net.ftp.FTPClient` | `getClient()` return the attached FTP client object.
    `java.lang.String` | `getCurpwd()` returns the path of the directory containing the AntFTPFile.
    `java.lang.String` | `getCurpwdPlusFileSep()` returns the path of the directory containing the AntFTPFile.
    `java.lang.String` | `getFastRelativePath()` find out the relative path assuming that the path used to construct this AntFTPFile was spelled properly with regards to case.
    `org.apache.commons.net.ftp.FTPFile` | `getFile(org.apache.commons.net.ftp.FTPFile[] theFiles, java.lang.String lastpathelement)` find a file matching a string in an array of FTPFile.
    `java.lang.String` | `getLink()` if the file is a symbolic link, find out to what it is pointing
    `java.lang.String` | `getName()` get the name of the file
    `java.lang.String` | `getRelativePath()` find out the relative path to the rootPath of the enclosing scanner.
    `boolean` | `isDirectory()` tell if a file is a directory.
    `boolean` | `isSymbolicLink()` tell if a file is a symbolic link
    `boolean` | `isTraverseSymlinks()` find out if a symbolic link is encountered in the relative path of this file from rootPath.
    `protected void` | `setCurpwd(java.lang.String curpwd)` sets the current path of an AntFTPFile
    `java.lang.String` | `toString()` Get a string rep of this object.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile

          public FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile(org.apache.commons.net.ftp.FTPClient client,
                                                          org.apache.commons.net.ftp.FTPFile ftpFile,
                                                          java.lang.String curpwd)

      constructor
      Parameters:
        `client` - ftp client variable
        `ftpFile` - the file
        `curpwd` - absolute remote path where the file is found

    - #### FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile

          public FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile(FTPTaskMirrorImpl.FTPDirectoryScanner.AntFTPFile parent,
                                                          java.lang.String path)

      other constructor
      Parameters:
        `parent` - the parent file
        `path` - a relative path to the parent file

  - ### Method Detail

    - #### exists

          public boolean exists()

      find out if the file exists
      Returns:
        true if the file exists

    - #### getLink

          public java.lang.String getLink()

      if the file is a symbolic link, find out to what it is pointing
      Returns:
        the target of the symbolic link

    - #### getName

          public java.lang.String getName()

      get the name of the file
      Returns:
        the name of the file

    - #### getAbsolutePath

          public java.lang.String getAbsolutePath()

      find out the absolute path of the file
      Returns:
        absolute path as string

    - #### getFastRelativePath

          public java.lang.String getFastRelativePath()

      find out the relative path assuming that the path used to construct this AntFTPFile was spelled properly with regards to case. This is OK on a case sensitive system such as UNIX
      Returns:
        relative path

    - #### getRelativePath

          public java.lang.String getRelativePath()
                                           throws java.io.IOException,
                                                  BuildException

      find out the relative path to the rootPath of the enclosing scanner. this relative path is spelled exactly like on disk, for instance if the AntFTPFile has been instantiated as ALPHA, but the file is really called alpha, this method will return alpha. If a symbolic link is encountered, it is followed, but the name of the link rather than the name of the target is returned. (ie does not behave like File.getCanonicalPath())
      Returns:
        relative path, separated by remoteFileSep
      Throws:
        `java.io.IOException` - if a change directory fails, ...
        `BuildException` - if one of the components of the relative path cannot be found.

    - #### getFile

          public org.apache.commons.net.ftp.FTPFile getFile(org.apache.commons.net.ftp.FTPFile[] theFiles,
                                                   java.lang.String lastpathelement)

      find a file matching a string in an array of FTPFile. This method will find "alpha" when requested for "ALPHA" if and only if the caseSensitive attribute is set to false. When caseSensitive is set to true, only the exact match is returned.
      Parameters:
        `theFiles` - array of files
        `lastpathelement` - the file name being sought
      Returns:
        null if the file cannot be found, otherwise return the matching file.

    - #### isDirectory

          public boolean isDirectory()

      tell if a file is a directory. note that it will return false for symbolic links pointing to directories.
      Returns:
        `true` for directories

    - #### isSymbolicLink

          public boolean isSymbolicLink()

      tell if a file is a symbolic link
      Returns:
        `true` for symbolic links

    - #### getClient

          protected org.apache.commons.net.ftp.FTPClient getClient()

      return the attached FTP client object. Warning : this instance is really shared with the enclosing class.
      Returns:
        FTP client

    - #### setCurpwd

          protected void setCurpwd(java.lang.String curpwd)

      sets the current path of an AntFTPFile
      Parameters:
        `curpwd` - the current path one wants to set

    - #### getCurpwd

          public java.lang.String getCurpwd()

      returns the path of the directory containing the AntFTPFile. of the full path of the file itself in case of AntFTPRootFile
      Returns:
        parent directory of the AntFTPFile

    - #### getCurpwdPlusFileSep

          public java.lang.String getCurpwdPlusFileSep()

      returns the path of the directory containing the AntFTPFile. of the full path of the file itself in case of AntFTPRootFile and appends the remote file separator if necessary.
      Returns:
        parent directory of the AntFTPFile
      Since:
        Ant 1.8.2

    - #### isTraverseSymlinks

          public boolean isTraverseSymlinks()
                                     throws java.io.IOException,
                                            BuildException

      find out if a symbolic link is encountered in the relative path of this file from rootPath.
      Returns:
        `true` if a symbolic link is encountered in the relative path.
      Throws:
        `java.io.IOException` - if one of the change directory or directory listing operations fails
        `BuildException` - if a path component in the relative path cannot be found.

    - #### toString

          public java.lang.String toString()

      Get a string rep of this object.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string containing the pwd and the file.