org.apache.tools.ant.taskdefs.optional.net
Class FTP.FTPDirectoryScanner.AntFTPFile
java.lang.Object
org.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScanner.AntFTPFile
- FTP.FTPDirectoryScanner
protected class FTP.FTPDirectoryScanner.AntFTPFile
extends java.lang.Object
an AntFTPFile is a representation of a remote file
boolean | exists() - find out if the file exists
|
String | getAbsolutePath() - find out the absolute path of the file
|
protected FTPClient | getClient() - return the attached FTP client object.
|
String | getCurpwd() - returns the path of the directory containing the AntFTPFile.
|
String | getFastRelativePath() - find out the relative path assuming that the path used to construct
this AntFTPFile was spelled properly with regards to case.
|
FTPFile | getFile(FTPFile[] theFiles, String lastpathelement) - find a file matching a string in an array of FTPFile.
|
String | getLink() - if the file is a symbolic link, find out to what it is pointing
|
String | getName() - get the name of the file
|
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(String curpwd) - sets the current path of an AntFTPFile
|
AntFTPFile
public AntFTPFile(FTPClient client,
FTPFile ftpFile,
String curpwd)
constructor
client
- ftp client variableftpFile
- the filecurpwd
- absolute remote path where the file is found
exists
public boolean exists()
find out if the file exists
getAbsolutePath
public String getAbsolutePath()
find out the absolute path of the file
getClient
protected FTPClient getClient()
return the attached FTP client object.
Warning : this instance is really shared with the enclosing class.
getCurpwd
public String getCurpwd()
returns the path of the directory containing the AntFTPFile.
of the full path of the file itself in case of AntFTPRootFile
- parent directory of the AntFTPFile
getFastRelativePath
public 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
getFile
public FTPFile getFile(FTPFile[] theFiles,
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.
theFiles
- array of fileslastpathelement
- the file name being sought
- null if the file cannot be found, otherwise return the matching file.
getLink
public String getLink()
if the file is a symbolic link, find out to what it is pointing
- the target of the symbolic link
getName
public String getName()
get the name of the file
getRelativePath
public String getRelativePath()
throws 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())
- relative path, separated by remoteFileSep
BuildException
- if one of the components of the relative path cannot
be found.
isDirectory
public boolean isDirectory()
tell if a file is a directory.
note that it will return false for symbolic links pointing to directories.
isSymbolicLink
public boolean isSymbolicLink()
tell if a file is a symbolic link
isTraverseSymlinks
public boolean isTraverseSymlinks()
throws IOException,
BuildException
find out if a symbolic link is encountered in the relative path of this file
from rootPath.
true
if a symbolic link is encountered in the relative path.
BuildException
- if a path component in the relative path cannot be found.
setCurpwd
protected void setCurpwd(String curpwd)
sets the current path of an AntFTPFile
curpwd
- the current path one wants to set
Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.