public class SSHFTPClient extends SCPClient implements ProFTPClientInterface
SSHFTPClient implements SFTP (SSH File Transfer Protocol).
Connections are established when the connect() is invoked.
Before it is called, the remote host must be defined, and
host verification and client authentication should be
configured.
Host Validation is the process of verifying that a host that is
being connected to is the host that was requested. Host validation is
done through an instance of SSHFTPValidator or a subclass
thereof. By default, SSHFTPClient, has an instance of
this class that is available by means of the getValidator()
method. Unless specialized validation functionality is required,
initialization of validation functionality may be done simply by invoking
methods on this object.
There are four approaches to setting up host validation:
ftpClient.getValidator().setHostValidationEnabled(false);
jackspc ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIE...If there are more than one host using a given key the host-name may be replaced by a comma-separated list of host-names. Wildcards may not be used. A host-file is loaded as follows:
ftpClient.getValidator().loadKnownHosts("~/.ssh/known_hosts");
ftpClient.getValidator().addKnownHost("host1pk.pub");
ftpClient.getValidator().addKnownHost("host2pk.pub");
Public keys should be in OpenSSH or SECSH format.
Client Authentication is the method used by the server to authenticate
clients. Different servers will enforce different policies for authenticating
clients. SSHFTPClient currently offers two authentication methods:
setAuthentication as follows:
ftpClient.setAuthentication("jack", "my_ftp_password");
ftpClient.setAuthentication("myprivatekey", "jack", "my_keyfile_password");
The user-name is the name of the user on the SFTP server, but the passphrase
is the password for the key-file (if there is a password).
| Modifier and Type | Class and Description |
|---|---|
static class |
SSHFTPClient.ConfigFlags
ConfigFlags contains various static integers which are used
to configure clients. |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ENCODING
Default encoding used for control data
|
static java.lang.String |
EOL_CRLF
Carriage return + line feed end of line marker
|
static java.lang.String |
EOL_LF
Line feed end of line marker
|
authenticator, connProps, DEFAULT_PORT, deleteCount, downloadCount, id, license, proxySettings, retryAuthenticator, ssh, uploadCount, validatorcvsId| Constructor and Description |
|---|
SSHFTPClient()
Constructs an SFTP client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelResume()
Cancel the resume.
|
void |
cancelTransfer()
Cancels the current transfer.
|
void |
cdup()
Change the remote working directory to
the parent directory
|
void |
changeGroup(int gid,
java.lang.String path)
Sets the group ID for the file or directory.
|
void |
changeMode(int permissions,
java.lang.String path)
Changes the access permissions or modes of the specified file or
directory.
|
void |
changeMode(java.lang.String permissions,
java.lang.String path)
Changes the access permissions or modes of the specified file or
directory.
|
void |
changeOwner(int uid,
java.lang.String path)
Sets the user ID to owner for the file or directory.
|
void |
chdir(java.lang.String dir)
Change the remote working directory to
that supplied
|
boolean |
checkDirReadableForChDir()
Check that a directory is readable prior to changing into it
|
void |
connect()
Connects to the server at the address and port number defined in the
constructor.
|
boolean |
connected()
Is the client currently connected?
|
void |
delete(java.lang.String remoteFile)
Delete the specified remote file
|
java.lang.String[] |
dir()
List current directory's contents as an array of strings of
filenames.
|
java.lang.String[] |
dir(java.lang.String dirname)
List a directory's contents as an array of strings of filenames.
|
java.lang.String[] |
dir(java.lang.String dirname,
boolean full)
List a directory's contents as an array of strings.
|
FTPFile[] |
dirDetails(java.lang.String dirname)
List a directory's contents as an array of FTPFile objects.
|
void |
dirDetails(java.lang.String dirname,
DirectoryListCallback lister)
List a directory's contents via a callback.
|
boolean |
exists(java.lang.String remoteFile)
Does the named file exist in the current server directory?
|
FTPFile |
fileDetails(java.lang.String name)
Get details about the named file
|
void |
get(java.io.OutputStream destStream,
java.lang.String remoteFile)
Get data from the FTP server.
|
byte[] |
get(java.lang.String remoteFile)
Get data from the FTP server.
|
void |
get(java.lang.String localPath,
java.lang.String remoteFile)
Download a file
|
int |
getConfigFlags()
Get the set configuration flags.
|
int |
getCountBeforeSleep()
Get the number of transfers set before sleeping
|
java.lang.String |
getDetectedRemoteEOL()
Get the EOL detected by the client
|
boolean |
getDetectTransferMode()
Get the detect transfer mode
|
boolean |
getFileLockingEnabled()
Determine if file locking on local downloaded files is being used or not.
|
static SSHFTPPublicKey |
getHostPublicKey(java.lang.String remoteHost)
Helper method that may be used to obtain a server's public key without
instantiating an
SSHFTPClient. |
static SSHFTPPublicKey |
getHostPublicKey(java.lang.String remoteHost,
int remotePort)
Helper method that may be used to obtain a server's public key without
instantiating an
SSHFTPClient. |
int |
getMaxPacketSize()
Get the max packet size set
|
int |
getMaxQueuedReadRequests() |
int |
getMaxTransferRate()
Get the maximum bandwidth for transfers
|
long |
getMonitorInterval()
Get the bytes transferred between each callback on the
progress monitor
|
FTPProgressMonitor |
getProgressMonitor()
Get the reference to the progress monitor
|
FTPProgressMonitorEx |
getProgressMonitorEx()
Get reference to the transfer listener
|
java.lang.String |
getRemoteEOL()
Get the remote EOL string that is
forced to be used irrespective of what is
detected from server information.
|
long |
getServerResponseTimeout()
Deprecated.
|
java.lang.String |
getSFTPSubsystemPath()
Returns the server-side path of the SFTP subsystem (default is null).
|
int |
getSleepTime()
Get the number of seconds spent asleep
|
int |
getTransferBufferSize()
Get the size of the buffers used in writing to and reading from
the server
|
FTPTransferType |
getType()
Get the current transfer type
|
java.lang.String |
getUmask()
Get the current umask
|
boolean |
isParallelMode()
Is the client in parallel write mode, which
is the default
|
boolean |
isSleepEnabled()
Is sleeping enabled?
|
boolean |
isTransferCancelled()
Has the current transfer been cancelled?
|
void |
keepAlive()
Tries to keep the current connection alive by
sending an innocuous command to signal that the
client is still active
|
void |
mdelete(java.io.FileFilter filter)
Deletes all files matching the filter in the current remote directory only
|
void |
mdelete(java.lang.String wildcard)
Deletes all files matching the wildcard in the current remote directory only
|
void |
mdelete(java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
Delete all the files in this directory (and its subdirectories if recurse is true) that match
the supplied filter.
|
void |
mdelete(java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
Delete all the files in this directory (and its subdirectories if recurse is true) that match
the supplied wildcard.
|
void |
mget(java.lang.String localDir,
java.io.FileFilter filter)
Get all files matching the filter in the current remote directory only into
the supplied local directory
|
void |
mget(java.lang.String localDir,
java.lang.String wildcard)
Get all files matching the filter in the current remote directory only into
the supplied local directory
|
void |
mget(java.lang.String localDir,
java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
Gets this entire remote directory and its contents, recursively going
through the remote directory name supplied.
|
void |
mget(java.lang.String localDir,
java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
Gets this entire remote directory and its contents, recursively going
through the remote directory name supplied.
|
void |
mkdir(java.lang.String dir)
Create the specified remote working directory
|
java.util.Date |
modtime(java.lang.String remoteFile)
Get modification time for a remote file.
|
void |
mput(java.lang.String localDir,
java.io.FileFilter filter)
Put all files matching the wildcard in the supplied local directory only into
the current remote directory
|
void |
mput(java.lang.String localDir,
java.lang.String wildcard)
Put all files matching the wildcard in the supplied local directory only into
the current remote directory
|
void |
mput(java.lang.String localDir,
java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
Puts this entire directory and its contents.
|
void |
mput(java.lang.String localDir,
java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
Puts this entire directory and its contents.
|
java.lang.String |
put(byte[] bytes,
java.lang.String remoteFile)
Put data onto the FTP server.
|
java.lang.String |
put(byte[] bytes,
java.lang.String remoteFile,
boolean append)
Put data onto the FTP server.
|
java.lang.String |
put(java.io.InputStream srcStream,
java.lang.String remoteFile)
Put a stream of data onto the FTP server.
|
java.lang.String |
put(java.io.InputStream srcStream,
java.lang.String remoteFile,
boolean append)
Put a stream of data onto the FTP server.
|
java.lang.String |
put(java.lang.String localPath,
java.lang.String remoteFile)
Upload a file.
|
java.lang.String |
put(java.lang.String localPath,
java.lang.String remoteFile,
boolean append)
Put a local file onto the FTP server.
|
java.lang.String |
pwd()
Get the current remote working directory
|
void |
quit()
Quit the FTP session
|
void |
quitImmediately()
Quit the FTP session immediately.
|
void |
rename(java.lang.String from,
java.lang.String to)
Rename a file or directory
|
void |
resume()
Make the next file transfer (put or get) resume.
|
void |
resumeNextDownload(long offset)
Resumes the next download from the offset point, which must be smaller
than the length of the file to be downloaded.
|
void |
rmdir(java.lang.String dir)
Delete the specified remote working directory
|
void |
rmdir(java.lang.String remoteDir,
boolean recurse)
Delete this remote directory.
|
void |
setCheckDirReadableForChDir(boolean checkDirReadableForChDir)
Set the check for directory readability prior to changing the directory on or off
|
void |
setConfigFlags(int configFlags)
Set the configuration flags.
|
void |
setControlEncoding(java.lang.String controlEncoding)
Set the encoding.
|
void |
setCountBeforeSleep(int countBeforeSleep)
Set the number of transfers required before sleeping
|
void |
setDetectTransferMode(boolean detectTransferMode)
Set autodetect of filetypes on or off.
|
void |
setFileLockingEnabled(boolean fileLockingEnabled)
Set file locking to enabled or disabled.
|
void |
setMaxPacketSize(int maxPacketSize)
Set the maximum packet size.
|
void |
setMaxQueuedReadRequests(int maxQueuedReadRequests)
In SFTP, files are read block-by-block.
|
void |
setMaxTransferRate(int thresholdBytesPerSecond)
Set the maximum transfer rates in bytes per sec
|
void |
setModTime(java.lang.String path,
java.util.Date modTime)
Set the last modified time for the supplied file
|
void |
setMonitorInterval(long interval)
Set the progress monitor interval for notifications
|
void |
setParallelMode(boolean parallelWriteMode)
Switch parallel write mode on or off
|
void |
setProgressMonitor(FTPProgressMonitor monitor)
Set a progress monitor for callbacks.
|
void |
setProgressMonitor(FTPProgressMonitor monitor,
long interval)
Set a progress monitor for callbacks.
|
void |
setProgressMonitorEx(FTPProgressMonitorEx monitorEx)
Set reference to the transfer listener
|
void |
setRemoteEOL(java.lang.String remoteEOL)
Set a remoteEOL to be forced, irrespective of what is detected from server information.
|
void |
setServerResponseTimeout(long serverResponseTimeout)
Deprecated.
Use
setTimeout(int) |
void |
setSFTPSubsystemPath(java.lang.String sftpSubsystemPath)
Sets the server-side path of the SFTP subsystem (default is null).
|
void |
setSleepEnabled(boolean sleepEnabled)
Set sleeping enabled to be on or off
|
void |
setSleepTime(int sleepTime)
Set the time spent asleep
|
void |
setTimeout(int millis)
Set the timeout on the underlying sockets and other resources
that may be used.
|
void |
setTransferBufferSize(int size)
Set the size of the buffers used in writing to and reading from
the server
|
void |
setType(FTPTransferType type)
Set the transfer type
|
void |
setUmask(java.lang.String umask)
Sets the umask used to write permissions
|
long |
size(java.lang.String remoteFile)
Get the size of a remote file.
|
java.lang.String |
toString()
String representation
|
checkConnection, connectSSH, disableAllAlgorithms, disableAllAlgorithms, executeCommand, getConnectionProperties, getDeleteCount, getDownloadCount, getEnabledAlgorithms, getEnabledAlgorithms, getHostPublicKey, getId, getNetworkBufferSize, getProxySettings, getRemoteHost, getRemotePort, getTimeout, getTransportProvider, getUploadCount, getValidator, isAlgorithmEnabled, isRekeyEnabled, resetDeleteCount, resetDownloadCount, resetUploadCount, setAlgorithmEnabled, setAuthentication, setAuthentication, setAuthentication, setAuthentication, setAuthentication, setAuthentication, setAuthentication, setAuthenticationChangePassword, setConnectionProperties, setId, setNetworkBufferSize, setProxyParams, setRekeyEnabled, setRekeyTransferLimit, setRemoteHost, setRemotePort, setTransportProvider, setValidator, system, validateAlgorithmsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProxySettingsexecuteCommand, getDeleteCount, getDownloadCount, getId, getNetworkBufferSize, getRemoteHost, getRemotePort, getTimeout, getUploadCount, resetDeleteCount, resetDownloadCount, resetUploadCount, setId, setNetworkBufferSize, setRemoteHost, setRemotePort, systempublic static final java.lang.String DEFAULT_ENCODING
public static final java.lang.String EOL_CRLF
public static final java.lang.String EOL_LF
public SSHFTPClient()
public void setConfigFlags(int configFlags)
throws FTPException
configFlags - configuration flags to setFTPExceptionpublic int getConfigFlags()
public boolean isParallelMode()
public void setParallelMode(boolean parallelWriteMode)
parallelWriteMode - true for on, false for offpublic int getMaxQueuedReadRequests()
public void setMaxQueuedReadRequests(int maxQueuedReadRequests)
maxQueuedReadRequests - the maximum number of requests to sendpublic boolean checkDirReadableForChDir()
public void setCheckDirReadableForChDir(boolean checkDirReadableForChDir)
checkDirReadableForChDir - true if checking for readabilitypublic boolean getFileLockingEnabled()
getFileLockingEnabled in interface FTPClientInterfacepublic void setFileLockingEnabled(boolean fileLockingEnabled)
setFileLockingEnabled in interface FTPClientInterfacefileLockingEnabled - true to enable locking, false to disablepublic void setMaxTransferRate(int thresholdBytesPerSecond)
setMaxTransferRate in interface ProFTPClientInterfacethresholdBytesPerSecond - maximum bytes per second to transferpublic int getMaxTransferRate()
getMaxTransferRate in interface ProFTPClientInterfacepublic long getServerResponseTimeout()
SCPClient.getTimeout()public void setServerResponseTimeout(long serverResponseTimeout)
throws FTPException
setTimeout(int)serverResponseTimeout - server response timeout in millisecondsFTPExceptionpublic void setControlEncoding(java.lang.String controlEncoding)
throws FTPException
setControlEncoding in interface FTPClientInterfacecontrolEncoding - The controlEncoding to set, which is the name of a CharsetFTPExceptionCharsetpublic static SSHFTPPublicKey getHostPublicKey(java.lang.String remoteHost) throws FTPException
SSHFTPClient. This method returns an
SSHFTPPublicKey object whose SSHFTPPublicKey.write(OutputStream, int)
method may be used to write the public key to a file. The method will
return null if a public key could not be retrieved. Logging may
be used to discover any connection problems. If more advanced settings are
required then an instance of SSHFTPClient should be used.remoteHost - Address of the server whose public key is to be fetched.SSHFTPPublicKey representingFTPExceptionpublic static SSHFTPPublicKey getHostPublicKey(java.lang.String remoteHost, int remotePort) throws FTPException
SSHFTPClient. This method returns an
SSHFTPPublicKey object SSHFTPPublicKey.write(OutputStream,int)
method may be used to write the public key to a file. The method will
return null if a public key could not be retrieved. Logging may
be used to discover any connection problems. If more advanced settings are
required then an instance of SSHFTPClient should be used.remoteHost - Address of the server whose public key is to be fetched.remotePort - Port of the server whose public key is to be fetched.SSHFTPPublicKey representingFTPExceptionpublic void setTimeout(int millis)
throws FTPException
FTPClientInterfacesetTimeout in interface FTPClientInterfacesetTimeout in class SCPClientmillis - The length of the timeout, in millisecondsFTPExceptionpublic void setDetectTransferMode(boolean detectTransferMode)
FTPClientInterfacesetDetectTransferMode in interface FTPClientInterfacedetectTransferMode - true if detecting transfer mode, false if notpublic boolean getDetectTransferMode()
FTPClientInterfacegetDetectTransferMode in interface FTPClientInterfacepublic int getMaxPacketSize()
public void setMaxPacketSize(int maxPacketSize)
throws FTPException
maxPacketSize - size to setFTPExceptionpublic void setTransferBufferSize(int size)
size - new size of buffer in bytespublic int getTransferBufferSize()
public void setRemoteEOL(java.lang.String remoteEOL)
remoteEOL - remoteEOL to forcepublic java.lang.String getRemoteEOL()
public FTPTransferType getType()
FTPClientInterfacegetType in interface FTPClientInterfacepublic void setType(FTPTransferType type)
FTPClientInterfacesetType in interface FTPClientInterfacetype - the transfer type to
set the server topublic java.lang.String getSFTPSubsystemPath()
null, which causes the sftp
subsystem to be used.public void setSFTPSubsystemPath(java.lang.String sftpSubsystemPath)
null, which causes the sftp subsystem
to be used. Setting this property is equivalent to using the
-s option on the OpenSSH sftp console command.sftpSubsystemPath - path of the SFTP subsystem on the server.public void resumeNextDownload(long offset)
throws FTPException
resumeNextDownload in interface FTPClientInterfaceoffset - offset bytes are skipped before downloading the file.FTPExceptionpublic void resume()
throws FTPException
FTPClientInterfaceresume in interface FTPClientInterfaceFTPExceptionpublic void cancelResume()
throws java.io.IOException,
FTPException
FTPClientInterfacecancelResume in interface FTPClientInterfacejava.io.IOExceptionFTPExceptionpublic void cancelTransfer()
FTPClientInterfacecancelTransfer in interface FTPClientInterfacepublic boolean isTransferCancelled()
public void connect()
throws java.io.IOException,
FTPException
connect in interface FTPClientInterfaceconnect in class SCPClientjava.io.IOException - Thrown if there is a TCP/IP-related error.FTPException - Thrown if client is already connected or if there is
a configuration error, or if a connection could not be established.public java.lang.String getDetectedRemoteEOL()
public boolean connected()
connected in interface FTPClientInterfaceconnected in class SCPClientpublic void setProgressMonitor(FTPProgressMonitor monitor, long interval)
FTPClientInterfacesetProgressMonitor in interface FTPClientInterfacemonitor - the monitor objectinterval - bytes transferred in between callbackspublic void setProgressMonitor(FTPProgressMonitor monitor)
FTPClientInterfacesetProgressMonitor in interface FTPClientInterfacemonitor - the monitor objectpublic long getMonitorInterval()
FTPClientInterfacegetMonitorInterval in interface FTPClientInterfacepublic void setMonitorInterval(long interval)
setMonitorInterval in interface ProFTPClientInterfaceinterval - notification intervalpublic FTPProgressMonitor getProgressMonitor()
public FTPProgressMonitorEx getProgressMonitorEx()
getProgressMonitorEx in interface ProFTPClientInterfacepublic void setProgressMonitorEx(FTPProgressMonitorEx monitorEx)
setProgressMonitorEx in interface ProFTPClientInterfacemonitorEx - transfer listenerpublic long size(java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfacesize in interface FTPClientInterfaceremoteFile - name or path of remote file in current directoryjava.io.IOExceptionFTPExceptionpublic java.lang.String put(java.lang.String localPath,
java.lang.String remoteFile)
throws java.io.IOException,
FTPException
SCPClientput in interface FTPClientInterfaceput in class SCPClientlocalPath - path of local file to be uploadedremoteFile - path of remote file to upload tojava.io.IOExceptionFTPExceptionpublic java.lang.String put(java.lang.String localPath,
java.lang.String remoteFile,
boolean append)
throws java.io.IOException,
FTPException
FTPClientInterfaceput in interface FTPClientInterfacelocalPath - path of the local fileremoteFile - name of remote file in current directory, or null if
a unique filename is to be generated by the serverappend - true if appending, false otherwisejava.io.IOExceptionFTPExceptionpublic java.lang.String put(java.io.InputStream srcStream,
java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfaceput in interface FTPClientInterfacesrcStream - input stream of data to putremoteFile - name of remote file in
current directory, or null if
a unique filename is to be generated by the serverjava.io.IOExceptionFTPExceptionpublic java.lang.String put(java.io.InputStream srcStream,
java.lang.String remoteFile,
boolean append)
throws java.io.IOException,
FTPException
FTPClientInterfaceput in interface FTPClientInterfacesrcStream - input stream of data to putremoteFile - name of remote file in
current directory, or null if
a unique filename is to be generated by the serverappend - true if appending, false otherwisejava.io.IOExceptionFTPExceptionpublic java.lang.String put(byte[] bytes,
java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfaceput in interface FTPClientInterfacebytes - array of bytesremoteFile - name of remote file in
current directory, or null if
a unique filename is to be generated by the serverjava.io.IOExceptionFTPExceptionpublic java.lang.String put(byte[] bytes,
java.lang.String remoteFile,
boolean append)
throws java.io.IOException,
FTPException
FTPClientInterfaceput in interface FTPClientInterfacebytes - array of bytesremoteFile - name of remote file in
current directory, or null if
a unique filename is to be generated by the serverappend - true if appending, false otherwisejava.io.IOExceptionFTPExceptionpublic void get(java.lang.String localPath,
java.lang.String remoteFile)
throws java.io.IOException,
FTPException
SCPClientget in interface FTPClientInterfaceget in class SCPClientlocalPath - path of local file to download toremoteFile - path of remote filejava.io.IOExceptionFTPExceptionpublic void get(java.io.OutputStream destStream,
java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfaceget in interface FTPClientInterfacedestStream - data stream to write data toremoteFile - name of remote file in
current directoryjava.io.IOExceptionFTPExceptionpublic byte[] get(java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfaceget in interface FTPClientInterfaceremoteFile - name of remote file in
current directoryjava.io.IOExceptionFTPExceptionpublic FTPFile fileDetails(java.lang.String name) throws java.io.IOException, FTPException
name - name of a filejava.io.IOExceptionFTPExceptionpublic void dirDetails(java.lang.String dirname,
DirectoryListCallback lister)
throws java.io.IOException,
FTPException,
java.text.ParseException
FTPClientInterfacedirDetails in interface FTPClientInterfacedirname - name of directory (some servers permit a filemask)lister - callback to be notified of errorsjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic FTPFile[] dirDetails(java.lang.String dirname) throws java.io.IOException, FTPException, java.text.ParseException
FTPClientInterfacedirDetails in interface FTPClientInterfacedirname - name of directory (some servers permit a filemask)java.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic java.lang.String[] dir()
throws java.io.IOException,
FTPException
FTPClientInterfacedir in interface FTPClientInterfacejava.io.IOExceptionFTPExceptionpublic java.lang.String[] dir(java.lang.String dirname)
throws java.io.IOException,
FTPException
FTPClientInterfacedir in interface FTPClientInterfacedirname - name of directory OR filemaskjava.io.IOExceptionFTPExceptionpublic java.lang.String[] dir(java.lang.String dirname,
boolean full)
throws java.io.IOException,
FTPException
FTPClientInterfacedir in interface FTPClientInterfacedirname - name of directory OR filemaskfull - true if detailed listing required
false otherwisejava.io.IOExceptionFTPExceptionpublic void delete(java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfacedelete in interface FTPClientInterfaceremoteFile - name of remote file to
deletejava.io.IOExceptionFTPExceptionpublic void rename(java.lang.String from,
java.lang.String to)
throws java.io.IOException,
FTPException
FTPClientInterfacerename in interface FTPClientInterfacefrom - name of file or directory to renameto - intended namejava.io.IOExceptionFTPExceptionpublic boolean exists(java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfaceexists in interface FTPClientInterfaceremoteFile - name of remote filejava.io.IOExceptionFTPExceptionpublic void rmdir(java.lang.String dir)
throws java.io.IOException,
FTPException
FTPClientInterfacermdir in interface FTPClientInterfacedir - name of remote directory to
deletejava.io.IOExceptionFTPExceptionpublic void mkdir(java.lang.String dir)
throws java.io.IOException,
FTPException
FTPClientInterfacemkdir in interface FTPClientInterfacedir - name of remote directory to
createjava.io.IOExceptionFTPExceptionpublic void changeMode(int permissions,
java.lang.String path)
throws java.io.IOException,
FTPException
Absolute modes are octal numbers specifying the complete list of attributes for the files; you specify attributes by OR'ing together these bits. These must be octal numbers as in the examples below. 0400 Individual read 0200 Individual write 0100 Individual execute (or list directory) 0040 Group read 0020 Group write 0010 Group execute 0004 Other read 0002 Other write 0001 Other execute
permissions - the absolute mode of the file/directory. These must be in octal, i.e.
they must be preceded with a '0'.path - the path to the file/directory on the remote serverjava.io.IOException - if an IO error occurs or the file if not foundFTPExceptionpublic void changeMode(java.lang.String permissions,
java.lang.String path)
throws java.io.IOException,
FTPException
Absolute modes are octal numbers specifying the complete list of attributes for the files; you specify attributes by OR'ing together these bits. These must be octal strings as in the examples below. 0400 Individual read 0200 Individual write 0100 Individual execute (or list directory) 0040 Group read 0020 Group write 0010 Group execute 0004 Other read 0002 Other write 0001 Other execute
permissions - the absolute mode of the file/directory. These must be an octal stringpath - the path to the file/directory on the remote serverjava.io.IOException - if an IO error occurs or the file if not foundFTPExceptionpublic void changeGroup(int gid,
java.lang.String path)
throws java.io.IOException,
FTPException
gid - the numeric group id for the new grouppath - the path to the remote file/directoryjava.io.IOException - if an IO error occurs or the file does not existFTPExceptionpublic void changeOwner(int uid,
java.lang.String path)
throws java.io.IOException,
FTPException
uid - numeric user id of the new ownerpath - the path to the remote file/directoryjava.io.IOException - if an IO error occurs or the file does not existFTPExceptionpublic void setUmask(java.lang.String umask)
throws FTPException
umask - umask as 4 digit octal, e.g. 0022FTPExceptionpublic java.lang.String getUmask()
throws FTPException
FTPExceptionpublic void chdir(java.lang.String dir)
throws java.io.IOException,
FTPException
FTPClientInterfacechdir in interface FTPClientInterfacedir - name of remote directory to
change tojava.io.IOExceptionFTPExceptionpublic void cdup()
throws java.io.IOException,
FTPException
FTPClientInterfacecdup in interface FTPClientInterfacejava.io.IOExceptionFTPExceptionpublic java.util.Date modtime(java.lang.String remoteFile)
throws java.io.IOException,
FTPException
FTPClientInterfacemodtime in interface FTPClientInterfaceremoteFile - name of remote filejava.io.IOExceptionFTPExceptionpublic void setModTime(java.lang.String path,
java.util.Date modTime)
throws java.io.IOException,
FTPException
setModTime in interface FTPClientInterfacepath - the path to the file/directory on the remote servermodTime - the time stamp (UTC) of when it was last modifiedjava.io.IOExceptionFTPExceptionpublic java.lang.String pwd()
throws java.io.IOException,
FTPException
FTPClientInterfacepwd in interface FTPClientInterfacejava.io.IOExceptionFTPExceptionpublic void mdelete(java.lang.String wildcard)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemdelete in interface ProFTPClientInterfacejava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mdelete(java.io.FileFilter filter)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemdelete in interface ProFTPClientInterfacefilter - file filterjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mdelete(java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemdelete in interface ProFTPClientInterfaceremoteDir - name of remote directorywildcard - filename wildcardrecurse - if true, recurse through subdirectoriesjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mdelete(java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemdelete in interface ProFTPClientInterfaceremoteDir - name of remote directoryfilter - filename filterrecurse - if true, recurse through subdirectoriesjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void rmdir(java.lang.String remoteDir,
boolean recurse)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacermdir in interface ProFTPClientInterfaceremoteDir - name of remote directoryrecurse - if true, recurse through subdirectoriesjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mput(java.lang.String localDir,
java.lang.String wildcard)
throws java.io.IOException,
FTPException
ProFTPClientInterfacemput in interface ProFTPClientInterfacelocalDir - local directory to get files fromwildcard - filename wildcardjava.io.IOExceptionFTPExceptionpublic void mput(java.lang.String localDir,
java.io.FileFilter filter)
throws java.io.IOException,
FTPException
ProFTPClientInterfacemput in interface ProFTPClientInterfacelocalDir - local directory to get files fromfilter - filename filterjava.io.IOExceptionFTPExceptionpublic void mput(java.lang.String localDir,
java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
throws FTPException,
java.io.IOException
ProFTPClientInterfacemput in interface ProFTPClientInterfacelocalDir - name of local directoryremoteDir - name of remote directorywildcard - filename wildcardrecurse - if true recurse into subdirectoriesFTPExceptionjava.io.IOExceptionpublic void mput(java.lang.String localDir,
java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
throws FTPException,
java.io.IOException
ProFTPClientInterfacemput in interface ProFTPClientInterfacelocalDir - name of local directoryremoteDir - name of remote directoryfilter - filename filterrecurse - if true recurse into subdirectoriesFTPExceptionjava.io.IOExceptionpublic void mget(java.lang.String localDir,
java.lang.String wildcard)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemget in interface ProFTPClientInterfacelocalDir - local directory to get files fromwildcard - filename wildcardjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mget(java.lang.String localDir,
java.io.FileFilter filter)
throws java.io.IOException,
FTPException,
java.text.ParseException
ProFTPClientInterfacemget in interface ProFTPClientInterfacelocalDir - local directory to get files fromfilter - filename filterjava.io.IOExceptionFTPExceptionjava.text.ParseExceptionpublic void mget(java.lang.String localDir,
java.lang.String remoteDir,
java.lang.String wildcard,
boolean recurse)
throws FTPException,
java.io.IOException,
java.text.ParseException
ProFTPClientInterfacemget in interface ProFTPClientInterfacelocalDir - name of local directory we are transferring intoremoteDir - name of remote directorywildcard - filename wildcardrecurse - if true recurse into subdirectoriesFTPExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic void mget(java.lang.String localDir,
java.lang.String remoteDir,
java.io.FileFilter filter,
boolean recurse)
throws FTPException,
java.io.IOException,
java.text.ParseException
ProFTPClientInterfacemget in interface ProFTPClientInterfacelocalDir - name of local directory we are transferring intoremoteDir - name of remote directoryfilter - filename filterrecurse - if true recurse into subdirectoriesFTPExceptionjava.io.IOExceptionjava.text.ParseExceptionpublic int getCountBeforeSleep()
ProFTPClientInterfacegetCountBeforeSleep in interface ProFTPClientInterfacepublic void setCountBeforeSleep(int countBeforeSleep)
ProFTPClientInterfacesetCountBeforeSleep in interface ProFTPClientInterfacecountBeforeSleep - maximum transfer countpublic boolean isSleepEnabled()
ProFTPClientInterfaceisSleepEnabled in interface ProFTPClientInterfacepublic void setSleepEnabled(boolean sleepEnabled)
ProFTPClientInterfacesetSleepEnabled in interface ProFTPClientInterfacesleepEnabled - if true, sleeping is enabled, otherwise it is switched offpublic int getSleepTime()
ProFTPClientInterfacegetSleepTime in interface ProFTPClientInterfacepublic void setSleepTime(int sleepTime)
ProFTPClientInterfacesetSleepTime in interface ProFTPClientInterfacesleepTime - sleep time in secondspublic void keepAlive()
throws java.io.IOException,
FTPException
keepAlive in interface FTPClientInterfacejava.io.IOExceptionFTPExceptionpublic void quit()
throws java.io.IOException,
FTPException
FTPClientInterfacequit in interface FTPClientInterfacequit in class SCPClientjava.io.IOExceptionFTPExceptionpublic void quitImmediately()
throws java.io.IOException,
FTPException
FTPClientInterfacequitImmediately in interface FTPClientInterfacequitImmediately in class SCPClientjava.io.IOExceptionFTPExceptionCopyright © 2001-2014 Enterprise Distributed Technologies Ltd. All Rights Reserved.