|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.sauronsoftware.ftp4j.FTPClient
public class FTPClient
This class implements a FTP client. You can use an instance of this class to connect to a remote FTP site and do FTP operations like directory listing, file upload and download, resume a broken upload/download and so on. The common flow is: create the object, connect to a remote FTP site with the connect() method, authenticate with login(), do anything you need with the contents of the remote site, quit the site with disconnect(). A FTPClient object can handle a connection per time. Once you have used and disconnected a FTPClient object you can use it again to connect another FTP server.
Field Summary | |
---|---|
static int |
TYPE_AUTO
The constant for the AUTO file transfer type. |
static int |
TYPE_BINARY
The constant for the BINARY file transfer type. |
static int |
TYPE_TEXTUAL
The constant for the TEXTUAL file transfer type. |
Constructor Summary | |
---|---|
FTPClient()
Builds and initializes the client. |
Method Summary | |
---|---|
void |
abortCurrentDataTransfer(boolean sendAborCommand)
If there's any ongoing data transfer operation, this method aborts it. |
void |
abruptlyCloseCommunication()
This method causes the communication channel to be abruptly closed. |
void |
addCommunicationListener(FTPCommunicationListener listener)
This method adds a FTPCommunicationListener to the object. |
void |
addListParser(FTPListParser listParser)
This method adds a FTPListParser to the object. |
void |
changeAccount(java.lang.String account)
Call this method to switch the user current account. |
void |
changeDirectory(java.lang.String path)
This method changes the current working directory. |
void |
changeDirectoryUp()
This method changes the current working directory to the parent one. |
java.lang.String[] |
connect(java.lang.String host)
This method connects the client to the remote FTP host, using the default port value 21. |
java.lang.String[] |
connect(java.lang.String host,
int port)
This method connects the client to the remote FTP host. |
void |
createDirectory(java.lang.String directoryName)
This method creates a new remote directory in the current working one. |
java.lang.String |
currentDirectory()
This method asks and returns the current working directory. |
void |
deleteDirectory(java.lang.String path)
This method deletes a remote directory. |
void |
deleteFile(java.lang.String path)
This method deletes a remote file. |
void |
disconnect(boolean sendQuitCommand)
This method disconnects from the remote server, optionally performing the QUIT procedure. |
void |
download(java.lang.String remoteFileName,
java.io.File localFile)
This method downloads a remote file from the server to a local file. |
void |
download(java.lang.String remoteFileName,
java.io.File localFile,
FTPDataTransferListener listener)
This method downloads a remote file from the server to a local file. |
void |
download(java.lang.String remoteFileName,
java.io.File localFile,
long restartAt)
This method resumes a download operation from the remote server to a local file. |
void |
download(java.lang.String remoteFileName,
java.io.File localFile,
long restartAt,
FTPDataTransferListener listener)
This method resumes a download operation from the remote server to a local file. |
void |
download(java.lang.String fileName,
java.io.OutputStream outputStream,
long restartAt,
FTPDataTransferListener listener)
This method resumes a download operation from the remote server. |
long |
fileSize(java.lang.String path)
This method asks and returns a file size in bytes. |
java.lang.String |
getCharset()
Returns the name of the charset used to establish textual communications. |
FTPCommunicationListener[] |
getCommunicationListeners()
This method returns a list with all the FTPCommunicationListener
used by the client. |
FTPConnector |
getConnector()
This method returns the connector used to connect the remote host. |
java.lang.String |
getHost()
If the client is connected, it reports the remote host name or address. |
FTPListParser[] |
getListParsers()
This method returns a list with all the FTPListParser used by the
client. |
java.lang.String |
getPassword()
If the client is authenticated, it reports the authentication password. |
int |
getPort()
If the client is connected, it reports the remote port number. |
FTPTextualExtensionRecognizer |
getTextualExtensionRecognizer()
This method returns the textual extension recognizer used by the client. |
int |
getType()
This method returns the value suggesting how the client encode and decode the contents during a data transfer. |
java.lang.String |
getUsername()
If the client is authenticated, it reports the authentication username. |
java.lang.String[] |
help()
This method calls the HELP command on the remote server, returning a list of lines with the help contents. |
boolean |
isAuthenticated()
This method tests if this client is authenticated. |
boolean |
isConnected()
This method tests if this client is connected to a remote FTP server. |
boolean |
isPassive()
This method tests if this client works in passive FTP mode. |
FTPFile[] |
list()
This method lists the entries of the current working directory parsing the reply to a FTP LIST command. |
java.lang.String[] |
listNames()
This method lists the entries of the current working directory with a FTP NLST command. |
void |
login(java.lang.String username,
java.lang.String password)
This method authenticates the user against the server. |
void |
login(java.lang.String username,
java.lang.String password,
java.lang.String account)
This method authenticates the user against the server. |
void |
logout()
This method performs a logout operation for the current user, leaving the connection open, thus it can be used to start a new user session. |
java.util.Date |
modifiedDate(java.lang.String path)
This method asks and returns the last modification date of a file or directory. |
void |
noop()
This method performs a "noop" operation with the server. |
void |
removeCommunicationListener(FTPCommunicationListener listener)
This method removes a FTPCommunicationListener previously added to the object. |
void |
removeListParser(FTPListParser listParser)
This method removes a FTPListParser previously added to the
object. |
void |
rename(java.lang.String oldPath,
java.lang.String newPath)
This method renames a remote file or directory. |
FTPReply |
sendCustomCommand(java.lang.String command)
This method sends a custom command to the server. |
FTPReply |
sendSiteCommand(java.lang.String command)
This method sends a SITE specific command to the server. |
java.lang.String[] |
serverStatus()
This method returns the remote server status, as the result of a FTP STAT command. |
void |
setCharset(java.lang.String charset)
Sets the name of the charset used to establish textual communications. |
void |
setConnector(FTPConnector connector)
This method sets the connector used to connect the remote host. |
void |
setPassive(boolean passive)
This method enables/disables the use of the passive mode. |
void |
setTextualExtensionRecognizer(FTPTextualExtensionRecognizer textualExtensionRecognizer)
This method sets the textual extension recognizer used by the client. |
void |
setType(int type)
This methods sets how to treat the contents during a file transfer. |
java.lang.String |
toString()
|
void |
upload(java.io.File file)
This method uploads a file to the remote server. |
void |
upload(java.io.File file,
FTPDataTransferListener listener)
This method uploads a file to the remote server. |
void |
upload(java.io.File file,
long restartAt)
This method resumes an upload of a file to the remote server. |
void |
upload(java.io.File file,
long restartAt,
FTPDataTransferListener listener)
This method resumes an upload of a file to the remote server. |
void |
upload(java.lang.String fileName,
java.io.InputStream inputStream,
long restartAt,
long streamOffset,
long streamLength,
FTPDataTransferListener listener)
This method resumes an upload to the remote server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_AUTO
public static final int TYPE_TEXTUAL
public static final int TYPE_BINARY
Constructor Detail |
---|
public FTPClient()
Method Detail |
---|
public FTPConnector getConnector()
public void setConnector(FTPConnector connector)
connector
- The connector used to connect the remote host.DirectConnector
public void setPassive(boolean passive)
passive
- If true the passive mode is enabled.public void setType(int type) throws java.lang.IllegalArgumentException
DefaultTextualExtensionRecognizer
.
type
- The type.
java.lang.IllegalArgumentException
- If the supplied type is not valid.setTextualExtensionRecognizer(FTPTextualExtensionRecognizer)
,
DefaultTextualExtensionRecognizer
public int getType()
public java.lang.String getCharset()
public void setCharset(java.lang.String charset)
charset
- The name of the charset used to establish textual
communications.public FTPTextualExtensionRecognizer getTextualExtensionRecognizer()
DefaultTextualExtensionRecognizer
.
DefaultTextualExtensionRecognizer
public void setTextualExtensionRecognizer(FTPTextualExtensionRecognizer textualExtensionRecognizer)
DefaultTextualExtensionRecognizer
.
You can plug your own by implementing the
FTPTextualExtensionRecognizer
interface. For your convenience the
ftp4j gives you another FTPTextualExtensionRecognizer implementation,
which is ParametricTextualExtensionRecognizer
.
textualExtensionRecognizer
- The textual extension recognizer used by the client.DefaultTextualExtensionRecognizer
,
ParametricTextualExtensionRecognizer
public boolean isAuthenticated()
public boolean isConnected()
public boolean isPassive()
public java.lang.String getHost()
public int getPort()
public java.lang.String getPassword()
public java.lang.String getUsername()
public void addCommunicationListener(FTPCommunicationListener listener)
listener
- The listener.public void removeCommunicationListener(FTPCommunicationListener listener)
listener
- The listener to be removed.public FTPCommunicationListener[] getCommunicationListeners()
FTPCommunicationListener
used by the client.
public void addListParser(FTPListParser listParser)
FTPListParser
to the object.
listParser
- The list parser.public void removeListParser(FTPListParser listParser)
FTPListParser
previously added to the
object.
listParser
- The list parser to be removed.public FTPListParser[] getListParsers()
FTPListParser
used by the
client.
public java.lang.String[] connect(java.lang.String host) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
host
- The hostname of the remote server.
java.lang.IllegalStateException
- If the client is already connected to a remote host.
java.io.IOException
- If an I/O occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the server refuses the connection.public java.lang.String[] connect(java.lang.String host, int port) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
host
- The host name or address of the remote server.port
- The port listened by the remote server.
java.lang.IllegalStateException
- If the client is already connected to a remote host.
java.io.IOException
- If an I/O occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the server refuses the connection.public void disconnect(boolean sendQuitCommand) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
sendQuitCommand
- If true the QUIT procedure with the server will be performed,
otherwise the connection is abruptly closed by the client
without sending any advice to the server.
java.lang.IllegalStateException
- If the client is not connected to a remote host.
java.io.IOException
- If an I/O occurs (can be thrown only if sendQuitCommand is
true).
FTPIllegalReplyException
- If the server replies in an illegal way (can be thrown only
if sendQuitCommand is true).
FTPException
- If the server refuses the QUIT command (can be thrown only if
sendQuitCommand is true).public void abruptlyCloseCommunication()
disconnect(boolean)
public void login(java.lang.String username, java.lang.String password) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
username
- The username.password
- The password (if none set it to null).
java.lang.IllegalStateException
- If the client is not connected. Call the connect() method
before!
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If login fails.public void login(java.lang.String username, java.lang.String password, java.lang.String account) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
username
- The username.password
- The password (if none set it to null).account
- The account (if none set it to null). Be careful: some servers
don't implement this feature.
java.lang.IllegalStateException
- If the client is not connected. Call the connect() method
before!
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If login fails.public void logout() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void noop() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If login fails.public FTPReply sendCustomCommand(java.lang.String command) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException
command
- The command line.
java.lang.IllegalStateException
- If this client is not connected.
java.io.IOException
- If a I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.public FTPReply sendSiteCommand(java.lang.String command) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException
command
- The site command.
java.lang.IllegalStateException
- If this client is not connected.
java.io.IOException
- If a I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.public void changeAccount(java.lang.String account) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
account
- The account.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If login fails.public java.lang.String currentDirectory() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void changeDirectory(java.lang.String path) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
path
- The path to the new working directory.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void changeDirectoryUp() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public java.util.Date modifiedDate(java.lang.String path) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
path
- The path to the file or the directory.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public long fileSize(java.lang.String path) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
path
- The path to the file.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void rename(java.lang.String oldPath, java.lang.String newPath) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
client.rename("oldname", "newname"); // This one renames
client.rename("the/old/path/oldname", "/a/new/path/newname"); // This one moves
oldPath
- The current path of the file (or directory).newPath
- The new path for the file (or directory).
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void deleteFile(java.lang.String path) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
path
- The path to the file.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void deleteDirectory(java.lang.String path) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
path
- The path to the directory.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public void createDirectory(java.lang.String directoryName) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
directoryName
- The name of the new directory.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public java.lang.String[] help() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public java.lang.String[] serverStatus() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.public FTPFile[] list() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException, FTPListParseException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.
FTPListParseException
- If none of the registered parsers can handle the response
sent by the server.FTPListParser
,
addListParser(FTPListParser)
,
getListParsers()
,
abortCurrentDataTransfer(boolean)
,
listNames()
public java.lang.String[] listNames() throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException, FTPListParseException
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.
FTPListParseException
- If none of the registered parsers can handle the response
sent by the server.abortCurrentDataTransfer(boolean)
,
list()
public void upload(java.io.File file) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
file
- The file to upload.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void upload(java.io.File file, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
file
- The file to upload.listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void upload(java.io.File file, long restartAt) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
file
- The file to upload.restartAt
- The restart point (number of bytes already uploaded).
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void upload(java.io.File file, long restartAt, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
file
- The file to upload.restartAt
- The restart point (number of bytes already uploaded).listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void upload(java.lang.String fileName, java.io.InputStream inputStream, long restartAt, long streamOffset, long streamLength, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
fileName
- The name of the remote file.inputStream
- The source of data.restartAt
- The restart point (number of bytes already uploaded).streamOffset
- The offset to skip in the stream.streamLength
- The length of the data of the stream to upload.listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void download(java.lang.String remoteFileName, java.io.File localFile) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
remoteFileName
- The name of the file to download.localFile
- The local file.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void download(java.lang.String remoteFileName, java.io.File localFile, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
remoteFileName
- The name of the file to download.localFile
- The local file.listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void download(java.lang.String remoteFileName, java.io.File localFile, long restartAt) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
remoteFileName
- The name of the file to download.localFile
- The local file.restartAt
- The restart point (number of bytes already downloaded).
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void download(java.lang.String remoteFileName, java.io.File localFile, long restartAt, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.FileNotFoundException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
remoteFileName
- The name of the file to download.localFile
- The local file.restartAt
- The restart point (number of bytes already downloaded).listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.FileNotFoundException
- If the supplied file cannot be found.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void download(java.lang.String fileName, java.io.OutputStream outputStream, long restartAt, FTPDataTransferListener listener) throws java.lang.IllegalStateException, java.io.IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
fileName
- The name of the remote file.outputStream
- The destination stream of data read during the download.restartAt
- The restart point (number of bytes already downloaded).listener
- The listener for the operation. Could be null.
java.lang.IllegalStateException
- If the client is not connected or not authenticated.
java.io.IOException
- If an I/O error occurs.
FTPIllegalReplyException
- If the server replies in an illegal way.
FTPException
- If the operation fails.
FTPDataTransferException
- If a I/O occurs in the data transfer connection. If you
receive this exception the transfer failed, but the main
connection with the remote FTP server is in theory still
working.
FTPAbortedException
- If operation is aborted by another thread.abortCurrentDataTransfer(boolean)
public void abortCurrentDataTransfer(boolean sendAborCommand) throws java.io.IOException, FTPIllegalReplyException
sendAborCommand
- If true the client will negotiate the abort procedure with the
server, through the standard FTP ABOR command. Otherwise the
open data transfer connection will be closed without any
advise has sent to the server.
java.io.IOException
- If the ABOR command cannot be sent due to any I/O error. This
could happen only if force is false.
FTPIllegalReplyException
- If the server reply to the ABOR command is illegal. This
could happen only if force is false.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |