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, validator
cvsId
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, validateAlgorithms
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProxySettings
executeCommand, getDeleteCount, getDownloadCount, getId, getNetworkBufferSize, getRemoteHost, getRemotePort, getTimeout, getUploadCount, resetDeleteCount, resetDownloadCount, resetUploadCount, setId, setNetworkBufferSize, setRemoteHost, setRemotePort, system
public 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 setFTPException
public 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 FTPClientInterface
public void setFileLockingEnabled(boolean fileLockingEnabled)
setFileLockingEnabled
in interface FTPClientInterface
fileLockingEnabled
- true to enable locking, false to disablepublic void setMaxTransferRate(int thresholdBytesPerSecond)
setMaxTransferRate
in interface ProFTPClientInterface
thresholdBytesPerSecond
- maximum bytes per second to transferpublic int getMaxTransferRate()
getMaxTransferRate
in interface ProFTPClientInterface
public long getServerResponseTimeout()
SCPClient.getTimeout()
public void setServerResponseTimeout(long serverResponseTimeout) throws FTPException
setTimeout(int)
serverResponseTimeout
- server response timeout in millisecondsFTPException
public void setControlEncoding(java.lang.String controlEncoding) throws FTPException
setControlEncoding
in interface FTPClientInterface
controlEncoding
- The controlEncoding to set, which is the name of a CharsetFTPException
Charset
public 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
representingFTPException
public 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
representingFTPException
public void setTimeout(int millis) throws FTPException
FTPClientInterface
setTimeout
in interface FTPClientInterface
setTimeout
in class SCPClient
millis
- The length of the timeout, in millisecondsFTPException
public void setDetectTransferMode(boolean detectTransferMode)
FTPClientInterface
setDetectTransferMode
in interface FTPClientInterface
detectTransferMode
- true if detecting transfer mode, false if notpublic boolean getDetectTransferMode()
FTPClientInterface
getDetectTransferMode
in interface FTPClientInterface
public int getMaxPacketSize()
public void setMaxPacketSize(int maxPacketSize) throws FTPException
maxPacketSize
- size to setFTPException
public 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()
FTPClientInterface
getType
in interface FTPClientInterface
public void setType(FTPTransferType type)
FTPClientInterface
setType
in interface FTPClientInterface
type
- 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 FTPClientInterface
offset
- offset bytes are skipped before downloading the file.FTPException
public void resume() throws FTPException
FTPClientInterface
resume
in interface FTPClientInterface
FTPException
public void cancelResume() throws java.io.IOException, FTPException
FTPClientInterface
cancelResume
in interface FTPClientInterface
java.io.IOException
FTPException
public void cancelTransfer()
FTPClientInterface
cancelTransfer
in interface FTPClientInterface
public boolean isTransferCancelled()
public void connect() throws java.io.IOException, FTPException
connect
in interface FTPClientInterface
connect
in class SCPClient
java.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 FTPClientInterface
connected
in class SCPClient
public void setProgressMonitor(FTPProgressMonitor monitor, long interval)
FTPClientInterface
setProgressMonitor
in interface FTPClientInterface
monitor
- the monitor objectinterval
- bytes transferred in between callbackspublic void setProgressMonitor(FTPProgressMonitor monitor)
FTPClientInterface
setProgressMonitor
in interface FTPClientInterface
monitor
- the monitor objectpublic long getMonitorInterval()
FTPClientInterface
getMonitorInterval
in interface FTPClientInterface
public void setMonitorInterval(long interval)
setMonitorInterval
in interface ProFTPClientInterface
interval
- notification intervalpublic FTPProgressMonitor getProgressMonitor()
public FTPProgressMonitorEx getProgressMonitorEx()
getProgressMonitorEx
in interface ProFTPClientInterface
public void setProgressMonitorEx(FTPProgressMonitorEx monitorEx)
setProgressMonitorEx
in interface ProFTPClientInterface
monitorEx
- transfer listenerpublic long size(java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
size
in interface FTPClientInterface
remoteFile
- name or path of remote file in current directoryjava.io.IOException
FTPException
public java.lang.String put(java.lang.String localPath, java.lang.String remoteFile) throws java.io.IOException, FTPException
SCPClient
put
in interface FTPClientInterface
put
in class SCPClient
localPath
- path of local file to be uploadedremoteFile
- path of remote file to upload tojava.io.IOException
FTPException
public java.lang.String put(java.lang.String localPath, java.lang.String remoteFile, boolean append) throws java.io.IOException, FTPException
FTPClientInterface
put
in interface FTPClientInterface
localPath
- 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.IOException
FTPException
public java.lang.String put(java.io.InputStream srcStream, java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
put
in interface FTPClientInterface
srcStream
- 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.IOException
FTPException
public java.lang.String put(java.io.InputStream srcStream, java.lang.String remoteFile, boolean append) throws java.io.IOException, FTPException
FTPClientInterface
put
in interface FTPClientInterface
srcStream
- 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.IOException
FTPException
public java.lang.String put(byte[] bytes, java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
put
in interface FTPClientInterface
bytes
- array of bytesremoteFile
- name of remote file in
current directory, or null if
a unique filename is to be generated by the serverjava.io.IOException
FTPException
public java.lang.String put(byte[] bytes, java.lang.String remoteFile, boolean append) throws java.io.IOException, FTPException
FTPClientInterface
put
in interface FTPClientInterface
bytes
- 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.IOException
FTPException
public void get(java.lang.String localPath, java.lang.String remoteFile) throws java.io.IOException, FTPException
SCPClient
get
in interface FTPClientInterface
get
in class SCPClient
localPath
- path of local file to download toremoteFile
- path of remote filejava.io.IOException
FTPException
public void get(java.io.OutputStream destStream, java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
get
in interface FTPClientInterface
destStream
- data stream to write data toremoteFile
- name of remote file in
current directoryjava.io.IOException
FTPException
public byte[] get(java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
get
in interface FTPClientInterface
remoteFile
- name of remote file in
current directoryjava.io.IOException
FTPException
public FTPFile fileDetails(java.lang.String name) throws java.io.IOException, FTPException
name
- name of a filejava.io.IOException
FTPException
public void dirDetails(java.lang.String dirname, DirectoryListCallback lister) throws java.io.IOException, FTPException, java.text.ParseException
FTPClientInterface
dirDetails
in interface FTPClientInterface
dirname
- name of directory (some servers permit a filemask)lister
- callback to be notified of errorsjava.io.IOException
FTPException
java.text.ParseException
public FTPFile[] dirDetails(java.lang.String dirname) throws java.io.IOException, FTPException, java.text.ParseException
FTPClientInterface
dirDetails
in interface FTPClientInterface
dirname
- name of directory (some servers permit a filemask)java.io.IOException
FTPException
java.text.ParseException
public java.lang.String[] dir() throws java.io.IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
java.io.IOException
FTPException
public java.lang.String[] dir(java.lang.String dirname) throws java.io.IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
dirname
- name of directory OR filemaskjava.io.IOException
FTPException
public java.lang.String[] dir(java.lang.String dirname, boolean full) throws java.io.IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
dirname
- name of directory OR filemaskfull
- true if detailed listing required
false otherwisejava.io.IOException
FTPException
public void delete(java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
delete
in interface FTPClientInterface
remoteFile
- name of remote file to
deletejava.io.IOException
FTPException
public void rename(java.lang.String from, java.lang.String to) throws java.io.IOException, FTPException
FTPClientInterface
rename
in interface FTPClientInterface
from
- name of file or directory to renameto
- intended namejava.io.IOException
FTPException
public boolean exists(java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
exists
in interface FTPClientInterface
remoteFile
- name of remote filejava.io.IOException
FTPException
public void rmdir(java.lang.String dir) throws java.io.IOException, FTPException
FTPClientInterface
rmdir
in interface FTPClientInterface
dir
- name of remote directory to
deletejava.io.IOException
FTPException
public void mkdir(java.lang.String dir) throws java.io.IOException, FTPException
FTPClientInterface
mkdir
in interface FTPClientInterface
dir
- name of remote directory to
createjava.io.IOException
FTPException
public 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 foundFTPException
public 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 foundFTPException
public 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 existFTPException
public 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 existFTPException
public void setUmask(java.lang.String umask) throws FTPException
umask
- umask as 4 digit octal, e.g. 0022FTPException
public java.lang.String getUmask() throws FTPException
FTPException
public void chdir(java.lang.String dir) throws java.io.IOException, FTPException
FTPClientInterface
chdir
in interface FTPClientInterface
dir
- name of remote directory to
change tojava.io.IOException
FTPException
public void cdup() throws java.io.IOException, FTPException
FTPClientInterface
cdup
in interface FTPClientInterface
java.io.IOException
FTPException
public java.util.Date modtime(java.lang.String remoteFile) throws java.io.IOException, FTPException
FTPClientInterface
modtime
in interface FTPClientInterface
remoteFile
- name of remote filejava.io.IOException
FTPException
public void setModTime(java.lang.String path, java.util.Date modTime) throws java.io.IOException, FTPException
setModTime
in interface FTPClientInterface
path
- the path to the file/directory on the remote servermodTime
- the time stamp (UTC) of when it was last modifiedjava.io.IOException
FTPException
public java.lang.String pwd() throws java.io.IOException, FTPException
FTPClientInterface
pwd
in interface FTPClientInterface
java.io.IOException
FTPException
public void mdelete(java.lang.String wildcard) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mdelete
in interface ProFTPClientInterface
java.io.IOException
FTPException
java.text.ParseException
public void mdelete(java.io.FileFilter filter) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mdelete
in interface ProFTPClientInterface
filter
- file filterjava.io.IOException
FTPException
java.text.ParseException
public void mdelete(java.lang.String remoteDir, java.lang.String wildcard, boolean recurse) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mdelete
in interface ProFTPClientInterface
remoteDir
- name of remote directorywildcard
- filename wildcardrecurse
- if true, recurse through subdirectoriesjava.io.IOException
FTPException
java.text.ParseException
public void mdelete(java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mdelete
in interface ProFTPClientInterface
remoteDir
- name of remote directoryfilter
- filename filterrecurse
- if true, recurse through subdirectoriesjava.io.IOException
FTPException
java.text.ParseException
public void rmdir(java.lang.String remoteDir, boolean recurse) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
rmdir
in interface ProFTPClientInterface
remoteDir
- name of remote directoryrecurse
- if true, recurse through subdirectoriesjava.io.IOException
FTPException
java.text.ParseException
public void mput(java.lang.String localDir, java.lang.String wildcard) throws java.io.IOException, FTPException
ProFTPClientInterface
mput
in interface ProFTPClientInterface
localDir
- local directory to get files fromwildcard
- filename wildcardjava.io.IOException
FTPException
public void mput(java.lang.String localDir, java.io.FileFilter filter) throws java.io.IOException, FTPException
ProFTPClientInterface
mput
in interface ProFTPClientInterface
localDir
- local directory to get files fromfilter
- filename filterjava.io.IOException
FTPException
public void mput(java.lang.String localDir, java.lang.String remoteDir, java.lang.String wildcard, boolean recurse) throws FTPException, java.io.IOException
ProFTPClientInterface
mput
in interface ProFTPClientInterface
localDir
- name of local directoryremoteDir
- name of remote directorywildcard
- filename wildcardrecurse
- if true recurse into subdirectoriesFTPException
java.io.IOException
public void mput(java.lang.String localDir, java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse) throws FTPException, java.io.IOException
ProFTPClientInterface
mput
in interface ProFTPClientInterface
localDir
- name of local directoryremoteDir
- name of remote directoryfilter
- filename filterrecurse
- if true recurse into subdirectoriesFTPException
java.io.IOException
public void mget(java.lang.String localDir, java.lang.String wildcard) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mget
in interface ProFTPClientInterface
localDir
- local directory to get files fromwildcard
- filename wildcardjava.io.IOException
FTPException
java.text.ParseException
public void mget(java.lang.String localDir, java.io.FileFilter filter) throws java.io.IOException, FTPException, java.text.ParseException
ProFTPClientInterface
mget
in interface ProFTPClientInterface
localDir
- local directory to get files fromfilter
- filename filterjava.io.IOException
FTPException
java.text.ParseException
public void mget(java.lang.String localDir, java.lang.String remoteDir, java.lang.String wildcard, boolean recurse) throws FTPException, java.io.IOException, java.text.ParseException
ProFTPClientInterface
mget
in interface ProFTPClientInterface
localDir
- name of local directory we are transferring intoremoteDir
- name of remote directorywildcard
- filename wildcardrecurse
- if true recurse into subdirectoriesFTPException
java.io.IOException
java.text.ParseException
public void mget(java.lang.String localDir, java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse) throws FTPException, java.io.IOException, java.text.ParseException
ProFTPClientInterface
mget
in interface ProFTPClientInterface
localDir
- name of local directory we are transferring intoremoteDir
- name of remote directoryfilter
- filename filterrecurse
- if true recurse into subdirectoriesFTPException
java.io.IOException
java.text.ParseException
public int getCountBeforeSleep()
ProFTPClientInterface
getCountBeforeSleep
in interface ProFTPClientInterface
public void setCountBeforeSleep(int countBeforeSleep)
ProFTPClientInterface
setCountBeforeSleep
in interface ProFTPClientInterface
countBeforeSleep
- maximum transfer countpublic boolean isSleepEnabled()
ProFTPClientInterface
isSleepEnabled
in interface ProFTPClientInterface
public void setSleepEnabled(boolean sleepEnabled)
ProFTPClientInterface
setSleepEnabled
in interface ProFTPClientInterface
sleepEnabled
- if true, sleeping is enabled, otherwise it is switched offpublic int getSleepTime()
ProFTPClientInterface
getSleepTime
in interface ProFTPClientInterface
public void setSleepTime(int sleepTime)
ProFTPClientInterface
setSleepTime
in interface ProFTPClientInterface
sleepTime
- sleep time in secondspublic void keepAlive() throws java.io.IOException, FTPException
keepAlive
in interface FTPClientInterface
java.io.IOException
FTPException
public void quit() throws java.io.IOException, FTPException
FTPClientInterface
quit
in interface FTPClientInterface
quit
in class SCPClient
java.io.IOException
FTPException
public void quitImmediately() throws java.io.IOException, FTPException
FTPClientInterface
quitImmediately
in interface FTPClientInterface
quitImmediately
in class SCPClient
java.io.IOException
FTPException
Copyright © 2001-2014 Enterprise Distributed Technologies Ltd. All Rights Reserved.