|
edtFTPj | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.enterprisedt.net.ftp.FTPClient
public class FTPClient
Supports client-side FTP. Most common FTP operations are present in this class.
Field Summary | |
---|---|
static byte |
CARRIAGE_RETURN
Used for ASCII translation |
protected FTPControlSocket |
control
Socket responsible for controlling the connection |
protected String |
controlEncoding
Encoding used on control socket |
protected int |
controlPort
Control port number. |
static String |
cvsId
Revision control id |
protected FTPDataSocket |
data
Socket responsible for transferring the data |
static int |
DEFAULT_BUFFER_SIZE
Default transfer buffer size |
static String |
DEFAULT_ENCODING
Default encoding used for control data |
static int |
DEFAULT_MONITOR_INTERVAL
Default byte interval for transfer monitor |
protected boolean |
detectTransferMode
If true, filetypes are autodetected and transfer mode changed to binary/ASCII as required |
protected DirectoryEmptyStrings |
dirEmptyStrings
Matcher for directory empty |
protected FileNotFoundStrings |
fileNotFoundStrings
Matcher for permission denied |
protected String |
id
Id of instance |
protected FTPReply |
lastValidReply
Holds the last valid reply from the server on the control socket |
static byte |
LINE_FEED
Used for ASCII translation |
protected FTPMessageListener |
messageListener
Message listener |
protected FTPProgressMonitor |
monitor
Progress monitor |
protected long |
monitorInterval
Bytes transferred in between monitor callbacks |
protected InetAddress |
remoteAddr
Address of the remote server. |
protected String |
remoteHost
Name/IP of remote host |
protected int |
serverWakeupInterval
Interval in seconds in between server wakeups. |
protected int |
timeout
Socket timeout for both data and control. |
protected int |
transferBufferSize
Size of transfer buffers |
protected TransferCompleteStrings |
transferCompleteStrings
Matcher for transfer complete |
protected FTPTransferType |
transferType
Record of the transfer type - make the default ASCII |
Constructor Summary | |
---|---|
FTPClient()
Default constructor should now always be used together with setter methods in preference to other constructors (now deprecated). |
|
FTPClient(InetAddress remoteAddr)
Deprecated. use setter methods to set properties |
|
FTPClient(InetAddress remoteAddr,
int controlPort)
Deprecated. use setter methods to set properties |
|
FTPClient(InetAddress remoteAddr,
int controlPort,
int timeout)
Deprecated. use setter methods to set properties |
|
FTPClient(InetAddress remoteAddr,
int controlPort,
int timeout,
String encoding)
Deprecated. use setter methods to set properties |
|
FTPClient(String remoteHost)
Deprecated. use setter methods to set properties |
|
FTPClient(String remoteHost,
int controlPort)
Deprecated. use setter methods to set properties |
|
FTPClient(String remoteHost,
int controlPort,
int timeout)
Deprecated. use setter methods to set properties |
|
FTPClient(String remoteHost,
int controlPort,
int timeout,
String encoding)
Deprecated. use setter methods to set properties |
Method Summary | |
---|---|
protected void |
abort()
Abort the current action |
void |
account(String accountInfo)
Supply account information string to the server. |
void |
cancelResume()
Cancel the resume. |
void |
cancelTransfer()
Cancels the current transfer. |
void |
cdup()
Change the remote working directory to the parent directory |
void |
chdir(String dir)
Change the remote working directory to that supplied |
protected void |
checkConnection(boolean shouldBeConnected)
Checks if the client has connected to the server and throws an exception if it hasn't. |
protected void |
chooseTransferMode(String filename)
Switch the transfer mode if requested and if necessary |
static void |
clearSOCKS()
Clear SOCKS settings. |
protected void |
closeDataSocket(InputStream stream)
Close stream for data socket. |
protected void |
closeDataSocket(OutputStream stream)
Close stream for data socket |
void |
connect()
Connects to the server at the address and port number defined in the constructor. |
boolean |
connected()
Is this client connected? |
void |
debugResponses(boolean on)
Deprecated. use the Logger class to switch debugging on and off |
void |
delete(String remoteFile)
Delete the specified remote file |
String[] |
dir()
List current directory's contents as an array of strings of filenames. |
String[] |
dir(String dirname)
List a directory's contents as an array of strings of filenames. |
String[] |
dir(String dirname,
boolean full)
List a directory's contents as an array of strings. |
FTPFile[] |
dirDetails(String dirname)
List a directory's contents as an array of FTPFile objects. |
boolean |
exists(String remoteFile)
Does the named file exist in the current server directory? |
String[] |
features()
Get the server supplied features |
FTPFile |
fileDetails(String name)
Uses the MLST command to find out details about the named file. |
protected void |
forceResumeOff()
Force the resume flag off. |
void |
get(OutputStream destStream,
String remoteFile)
Get data from the FTP server. |
byte[] |
get(String remoteFile)
Get data from the FTP server. |
void |
get(String localPath,
String remoteFile)
Get data from the FTP server. |
static String |
getBuildTimestamp()
Get the build timestamp |
FTPConnectMode |
getConnectMode()
|
String |
getControlEncoding()
Get the encoding used for the control connection |
int |
getControlPort()
Deprecated. Use FTPClientInterface.getRemotePort() instead. |
boolean |
getDetectTransferMode()
Get the detect transfer mode |
String |
getId()
Get the identifying string for this instance |
FTPReply |
getLastValidReply()
Gets the latest valid reply from the server |
FTPMessageListener |
getMessageListener()
|
long |
getMonitorInterval()
Get the bytes transferred between each callback on the progress monitor |
FTPProgressMonitor |
getProgressMonitor()
Get the reference to the progress monitor |
InetAddress |
getRemoteAddr()
|
String |
getRemoteHost()
Returns the IP address or name of the remote host. |
int |
getRemotePort()
Returns the control-port being connected to on the remote server. |
int |
getServerWakeupInterval()
Get server wakeup interval in seconds. |
int |
getTimeout()
Get the TCP timeout |
int |
getTransferBufferSize()
Get the size of the buffers used in writing to and reading from the data sockets |
FTPTransferType |
getType()
Get the current transfer type |
static int[] |
getVersion()
Get the version of edtFTPj |
String |
help(String command)
Get the help text for the specified command |
protected void |
initGet(String remoteFile)
Request to the server that the get is set up |
protected void |
initialize(FTPControlSocket control)
Set the control socket explicitly |
protected String |
initPut(String remoteFile,
boolean append)
Request the server to set up the put |
static void |
initSOCKS(String port,
String host)
Set up SOCKS v4/v5 proxy settings. |
static void |
initSOCKSAuthentication(String username,
String password)
Set up SOCKS username and password for SOCKS username/password authentication. |
boolean |
isAutoPassiveIPSubstitution()
Is automatic substitution of the remote host IP set to be on for passive mode connections? |
boolean |
isDeleteOnFailure()
If true, delete partially written files when exceptions are thrown during a download |
boolean |
isStrictReturnCodes()
Determine if strict checking of return codes is switched on. |
boolean |
isTransferCancelled()
Has the current transfer been cancelled? |
void |
keepAlive()
Tries to keep the current connection alive by sending an innocuous commmand to signal that the client is still active |
String |
list(String dirname)
Deprecated. As of FTP 1.1, replaced by dir(String) |
String |
list(String dirname,
boolean full)
Deprecated. As of FTP 1.1, replaced by dir(String,boolean) |
void |
login(String user,
String password)
Login into an account on the FTP server. |
void |
login(String user,
String password,
String accountInfo)
Login into an account on the FTP server. |
void |
mkdir(String dir)
Create the specified remote working directory |
Date |
modtime(String remoteFile)
Get modification time for a remote file. |
void |
noOperation()
Send a "no operation" message that does nothing. |
void |
password(String password)
Supplies the password for a previously supplied username to log into the FTP server. |
String |
put(byte[] bytes,
String remoteFile)
Put data onto the FTP server. |
String |
put(byte[] bytes,
String remoteFile,
boolean append)
Put data onto the FTP server. |
String |
put(InputStream srcStream,
String remoteFile)
Put a stream of data onto the FTP server. |
String |
put(InputStream srcStream,
String remoteFile,
boolean append)
Put a stream of data onto the FTP server. |
String |
put(String localPath,
String remoteFile)
Put a local file onto the FTP server. |
String |
put(String localPath,
String remoteFile,
boolean append)
Put a local file onto the FTP server. |
String |
pwd()
Get the current remote working directory |
void |
quit()
Quit the FTP session |
void |
quitImmediately()
Quit the FTP session immediately. |
String |
quote(String command,
String[] validCodes)
Issue arbitrary ftp commands to the FTP server. |
protected int |
readChar(LineNumberReader in)
Attempts to read a single character from the given InputStream . |
int |
readChunk(BufferedInputStream in,
byte[] chunk,
int chunksize)
Attempts to read a specified number of bytes from the given InputStream and place it in the given byte-array. |
protected String |
readLine(LineNumberReader in)
Attempts to read a single line from the given InputStream . |
void |
rename(String from,
String to)
Rename a file or directory |
void |
resetTransferMode(FTPTransferType previousType)
Reset the transfer mode back to what it should be, if it has changed. |
void |
restart(long size)
Issue the RESTart command to the remote server. |
void |
resume()
Make the next file transfer (put or get) resume. |
void |
rmdir(String dir)
Delete the specified remote working directory |
void |
sendServerWakeup()
Wake up the server during a transfer to prevent a timeout from occuring. |
void |
setActiveIPAddress(String forcedActiveIP)
We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations. |
void |
setActivePortRange(int lowest,
int highest)
Force a certain range of ports to be used in active mode. |
void |
setAutoPassiveIPSubstitution(boolean autoPassiveIPSubstitution)
Set automatic substitution of the remote host IP on if in passive mode |
void |
setConnectMode(FTPConnectMode mode)
Set the connect mode |
void |
setControlEncoding(String controlEncoding)
Set the control socket's encoding. |
void |
setControlPort(int controlPort)
Deprecated. Use FTPClientInterface.setRemotePort(int) instead. |
void |
setDeleteOnFailure(boolean deleteOnFailure)
Switch on or off the automatic deletion of partially written files that are left when an exception is thrown during a download |
void |
setDetectTransferMode(boolean detectTransferMode)
Set autodetect of filetypes on or off. |
void |
setFTPFileFactory(FTPFileFactory fileFactory)
Override the chosen file factory with a user created one - meaning that a specific parser has been selected |
void |
setId(String id)
Set the identifying string for this instance |
void |
setMessageListener(FTPMessageListener listener)
Set a listener that handles all FTP messages |
void |
setParserLocale(Locale locale)
Set the locale for date parsing of dir listings |
void |
setPORTIP(String IPAddress)
Deprecated. |
void |
setProgressMonitor(FTPProgressMonitor monitor)
Set a progress monitor for callbacks. |
void |
setProgressMonitor(FTPProgressMonitor monitor,
long interval)
Set a progress monitor for callbacks. |
void |
setRemoteAddr(InetAddress remoteAddr)
Set the remote address |
void |
setRemoteHost(String remoteHost)
Set the IP address or name of the remote host This may only be done if the client is not already connected to the server. |
void |
setRemotePort(int remotePort)
Set the control to connect to on the remote server. |
void |
setServerWakeupInterval(int interval)
Set server wakeup interval in seconds. |
void |
setStrictReturnCodes(boolean strict)
Set strict checking of FTP return codes. |
void |
setTimeout(int millis)
Set the SO_TIMEOUT in milliseconds on the underlying socket. |
void |
setTransferBufferSize(int size)
Set the size of the buffers used in writing to and reading from the data sockets |
void |
setType(FTPTransferType type)
Set the transfer type |
protected void |
setupDataSocket()
Set up the data socket |
boolean |
site(String command)
Run a site-specific command on the server. |
long |
size(String remoteFile)
Get the size of a remote file. |
String |
stat()
Sends stat message to enquire about the status of a transfer. |
String |
system()
Get the type of the OS at the server |
String |
toString()
String representation |
void |
user(String user)
Supply the user name to log into an account on the FTP server. |
void |
validateTransfer()
Validate that the put() or get() was successful. |
protected void |
validateTransferOnError(IOException ex)
Validate a transfer when an error has occurred on the data channel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static String cvsId
public static final int DEFAULT_MONITOR_INTERVAL
public static final int DEFAULT_BUFFER_SIZE
public static final String DEFAULT_ENCODING
public static final byte CARRIAGE_RETURN
public static final byte LINE_FEED
protected FTPControlSocket control
protected FTPDataSocket data
protected int timeout
protected int serverWakeupInterval
protected InetAddress remoteAddr
protected String remoteHost
protected String id
protected int controlPort
protected String controlEncoding
protected DirectoryEmptyStrings dirEmptyStrings
protected TransferCompleteStrings transferCompleteStrings
protected FileNotFoundStrings fileNotFoundStrings
protected boolean detectTransferMode
protected long monitorInterval
protected int transferBufferSize
protected FTPProgressMonitor monitor
protected FTPMessageListener messageListener
protected FTPTransferType transferType
protected FTPReply lastValidReply
Constructor Detail |
---|
public FTPClient(String remoteHost) throws IOException, FTPException
remoteHost
- the remote hostname
IOException
FTPException
public FTPClient(String remoteHost, int controlPort) throws IOException, FTPException
remoteHost
- the remote hostnamecontrolPort
- port for control stream (-1 for default port)
IOException
FTPException
public FTPClient(String remoteHost, int controlPort, int timeout) throws IOException, FTPException
remoteHost
- the remote hostnamecontrolPort
- port for control stream (use -1 for the default port)timeout
- the length of the timeout, in milliseconds
(pass in 0 for no timeout)
IOException
FTPException
public FTPClient(String remoteHost, int controlPort, int timeout, String encoding) throws IOException, FTPException
remoteHost
- the remote hostnamecontrolPort
- port for control stream (use -1 for the default port)timeout
- the length of the timeout, in milliseconds
(pass in 0 for no timeout)encoding
- character encoding used for data
IOException
FTPException
public FTPClient(InetAddress remoteAddr) throws IOException, FTPException
remoteAddr
- the address of the
remote host
IOException
FTPException
public FTPClient(InetAddress remoteAddr, int controlPort) throws IOException, FTPException
remoteAddr
- the address of the
remote hostcontrolPort
- port for control stream
IOException
FTPException
public FTPClient(InetAddress remoteAddr, int controlPort, int timeout) throws IOException, FTPException
remoteAddr
- the address of the
remote hostcontrolPort
- port for control stream (-1 for default port)timeout
- the length of the timeout, in milliseconds
(pass in 0 for no timeout)
IOException
FTPException
public FTPClient(InetAddress remoteAddr, int controlPort, int timeout, String encoding) throws IOException, FTPException
remoteAddr
- the address of the
remote hostcontrolPort
- port for control stream (-1 for default port)timeout
- the length of the timeout, in milliseconds
(pass in 0 for no timeout)encoding
- character encoding used for data
IOException
FTPException
public FTPClient()
connect()
method is used to perform the actual connection to the remote host - but only
for this constructor. Deprecated constructors connect in the constructor and
connect() is not required (and cannot be called).
Method Detail |
---|
public static int[] getVersion()
public static String getBuildTimestamp()
public void connect() throws IOException, FTPException
connect
in interface FTPClientInterface
IOException
- Thrown if there is a TCP/IP-related error.
FTPException
- Thrown if there is an error related to the FTP protocol.public boolean connected()
connected
in interface FTPClientInterface
protected void checkConnection(boolean shouldBeConnected) throws FTPException
FTPException
- Thrown if the client has not connected to the server.protected void initialize(FTPControlSocket control) throws IOException
control
- control socket reference
IOException
public void debugResponses(boolean on)
on
- true if you wish to have responses to
the log stream, false otherwisepublic String getId()
getId
in interface FTPClientInterface
public void setId(String id)
setId
in interface FTPClientInterface
id
- identifying stringpublic void setStrictReturnCodes(boolean strict)
strict
- true for strict checking, false for loose checkingpublic boolean isStrictReturnCodes()
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
protected void chooseTransferMode(String filename) throws IOException, FTPException
filename
- filename of file to be transferred
FTPException
IOException
public void setTimeout(int millis) throws IOException
setTimeout
in interface FTPClientInterface
millis
- The length of the timeout, in milliseconds
IOException
public int getTimeout()
getTimeout
in interface FTPClientInterface
public int getRemotePort()
getControlPort()
.
getRemotePort
in interface FTPClientInterface
public void setRemotePort(int remotePort) throws FTPException
setControlPort(int)
.
setRemotePort
in interface FTPClientInterface
remotePort
- The port to use.
FTPException
- Thrown if the client is already connected to the server.public int getControlPort()
FTPClientInterface.getRemotePort()
instead.
public void setControlPort(int controlPort) throws FTPException
FTPClientInterface.setRemotePort(int)
instead.
controlPort
- The port to use.
FTPException
- Thrown if the client is already connected to the server.public InetAddress getRemoteAddr()
public void setRemoteAddr(InetAddress remoteAddr) throws FTPException
remoteAddr
- The remoteAddr to set.
FTPException
public String getRemoteHost()
FTPClientInterface
getRemoteHost
in interface FTPClientInterface
public void setRemoteHost(String remoteHost) throws IOException, FTPException
FTPClientInterface
setRemoteHost
in interface FTPClientInterface
remoteHost
- The IP address or name of the remote host
FTPException
- Thrown if the client is already connected to the server.
IOException
public boolean isAutoPassiveIPSubstitution()
public void setAutoPassiveIPSubstitution(boolean autoPassiveIPSubstitution)
autoPassiveIPSubstitution
- true if set to on, false otherwisepublic int getServerWakeupInterval()
public void setServerWakeupInterval(int interval)
interval
- interval in secondspublic String getControlEncoding()
public void setControlEncoding(String controlEncoding) throws FTPException
controlEncoding
- The controlEncoding to set, which is the name of a Charset
FTPException
Charset
public FTPMessageListener getMessageListener()
public void setMessageListener(FTPMessageListener listener)
listener
- message listenerpublic void setConnectMode(FTPConnectMode mode)
mode
- ACTIVE or PASV modepublic FTPConnectMode getConnectMode()
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 FTPProgressMonitor getProgressMonitor()
public long getMonitorInterval()
FTPClientInterface
getMonitorInterval
in interface FTPClientInterface
public void setTransferBufferSize(int size)
size
- new size of buffer in bytespublic int getTransferBufferSize()
public void cancelTransfer()
FTPClientInterface
cancelTransfer
in interface FTPClientInterface
public boolean isTransferCancelled()
public boolean isDeleteOnFailure()
public void setDeleteOnFailure(boolean deleteOnFailure)
deleteOnFailure
- true if delete when a failure occurspublic void setPORTIP(String IPAddress) throws FTPException
IPAddress
- IP address to force, in 192.168.1.0 form
FTPException
public void setActiveIPAddress(String forcedActiveIP) throws FTPException
forcedActiveIP
- IP address to force, in 192.168.1.0 form or in IPV6 form, e.g.
1080::8:800:200C:417A
FTPException
public void setActivePortRange(int lowest, int highest) throws FTPException
lowest
- Lower limit of range.highest
- Upper limit of range.
FTPException
public void login(String user, String password) throws IOException, FTPException
user
- user namepassword
- user's password
IOException
FTPException
public void login(String user, String password, String accountInfo) throws IOException, FTPException
user
- user namepassword
- user's passwordaccountInfo
- account info string
IOException
FTPException
public void user(String user) throws IOException, FTPException
user
- user name
IOException
FTPException
public void password(String password) throws IOException, FTPException
password
- The password.
IOException
FTPException
public void account(String accountInfo) throws IOException, FTPException
accountInfo
- account information string
IOException
FTPException
public static void initSOCKS(String port, String host)
port
- SOCKS proxy porthost
- SOCKS proxy hostnamepublic static void initSOCKSAuthentication(String username, String password)
username
- the SOCKS usernamepassword
- the SOCKS passwordpublic static void clearSOCKS()
public String quote(String command, String[] validCodes) throws IOException, FTPException
command
- ftp command to be sent to servervalidCodes
- valid return codes for this command. If null
is supplied no validation is performed
IOException
FTPException
public boolean exists(String remoteFile) throws IOException, FTPException
FTPClientInterface
exists
in interface FTPClientInterface
remoteFile
- name of remote file
IOException
FTPException
public long size(String remoteFile) throws IOException, FTPException
FTPClientInterface
size
in interface FTPClientInterface
remoteFile
- name or path of remote file in current directory
IOException
FTPException
public void resume() throws FTPException
FTPClientInterface
resume
in interface FTPClientInterface
FTPException
public void cancelResume() throws IOException, FTPException
FTPClientInterface
cancelResume
in interface FTPClientInterface
IOException
FTPException
protected void forceResumeOff()
public void restart(long size) throws IOException, FTPException
size
- the REST param, the mark at which the restart is
performed on the remote file. For STOR, this is retrieved
by SIZE
IOException
FTPException
public String put(String localPath, String remoteFile) throws 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 server
IOException
FTPException
public String put(InputStream srcStream, String remoteFile) throws 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 server
IOException
FTPException
public String put(String localPath, String remoteFile, boolean append) throws 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 otherwise
IOException
FTPException
public String put(InputStream srcStream, String remoteFile, boolean append) throws 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 otherwise
IOException
FTPException
public void validateTransfer() throws IOException, FTPException
IOException
FTPException
protected void validateTransferOnError(IOException ex) throws IOException, FTPException
IOException
FTPException
protected void closeDataSocket(InputStream stream)
stream
- stream referenceprotected void closeDataSocket(OutputStream stream)
stream
- stream referenceprotected void setupDataSocket() throws IOException, FTPException
FTPException
IOException
protected String initPut(String remoteFile, boolean append) throws IOException, FTPException
remoteFile
- name of remote file in current directoryappend
- true if appending, false otherwise
IOException
FTPException
public String put(byte[] bytes, String remoteFile) throws 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 server
IOException
FTPException
public String put(byte[] bytes, String remoteFile, boolean append) throws 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 otherwise
IOException
FTPException
public void get(String localPath, String remoteFile) throws IOException, FTPException
FTPClientInterface
get
in interface FTPClientInterface
localPath
- local file to put data inremoteFile
- name of remote file in
current directory
IOException
FTPException
public void get(OutputStream destStream, String remoteFile) throws IOException, FTPException
FTPClientInterface
get
in interface FTPClientInterface
destStream
- data stream to write data toremoteFile
- name of remote file in
current directory
IOException
FTPException
public void resetTransferMode(FTPTransferType previousType) throws IOException, FTPException
previousType
- previous transfer type
IOException
FTPException
protected void initGet(String remoteFile) throws IOException, FTPException
remoteFile
- name of remote file
IOException
FTPException
public byte[] get(String remoteFile) throws IOException, FTPException
FTPClientInterface
get
in interface FTPClientInterface
remoteFile
- name of remote file in
current directory
IOException
FTPException
public boolean site(String command) throws IOException, FTPException
command
- the site command to run
IOException
FTPException
public String list(String dirname) throws IOException, FTPException
dir(String)
dirname
- the name of the directory (not a file mask)
IOException
FTPException
public String list(String dirname, boolean full) throws IOException, FTPException
dir(String,boolean)
dirname
- the name of the directory(not a file mask)full
- true if detailed listing required
false otherwise
IOException
FTPException
public void setFTPFileFactory(FTPFileFactory fileFactory)
fileFactory
- public void setParserLocale(Locale locale)
locale
- new locale to usepublic FTPFile fileDetails(String name) throws IOException, FTPException, ParseException
name
- name of a file
IOException
FTPException
ParseException
public FTPFile[] dirDetails(String dirname) throws IOException, FTPException, ParseException
FTPClientInterface
dirDetails
in interface FTPClientInterface
dirname
- name of directory (some servers permit a filemask)
IOException
FTPException
ParseException
public String[] dir() throws IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
IOException
FTPException
public String[] dir(String dirname) throws IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
dirname
- name of directory OR filemask
IOException
FTPException
public String[] dir(String dirname, boolean full) throws IOException, FTPException
FTPClientInterface
dir
in interface FTPClientInterface
dirname
- name of directory OR filemaskfull
- true if detailed listing required
false otherwise
IOException
FTPException
public int readChunk(BufferedInputStream in, byte[] chunk, int chunksize) throws IOException
InputStream
and place it in the given byte-array. The
purpose of this method is to permit subclasses to execute any additional
code necessary when performing this operation.
in
- The InputStream
to read from.chunk
- The byte-array to place read bytes in.chunksize
- Number of bytes to read.
IOException
- Thrown if there was an error while reading.protected int readChar(LineNumberReader in) throws IOException
InputStream
.
The purpose of this method is to permit subclasses to execute
any additional code necessary when performing this operation.
in
- The LineNumberReader
to read from.
IOException
- Thrown if there was an error while reading.protected String readLine(LineNumberReader in) throws IOException
InputStream
.
The purpose of this method is to permit subclasses to execute
any additional code necessary when performing this operation.
in
- The LineNumberReader
to read from.
IOException
- Thrown if there was an error while reading.public FTPReply getLastValidReply()
public FTPTransferType getType()
getType
in interface FTPClientInterface
public void setType(FTPTransferType type) throws IOException, FTPException
setType
in interface FTPClientInterface
type
- the transfer type to
set the server to
IOException
FTPException
public void delete(String remoteFile) throws IOException, FTPException
FTPClientInterface
delete
in interface FTPClientInterface
remoteFile
- name of remote file to
delete
IOException
FTPException
public void rename(String from, String to) throws IOException, FTPException
FTPClientInterface
rename
in interface FTPClientInterface
from
- name of file or directory to renameto
- intended name
IOException
FTPException
public void rmdir(String dir) throws IOException, FTPException
FTPClientInterface
rmdir
in interface FTPClientInterface
dir
- name of remote directory to
delete
IOException
FTPException
public void mkdir(String dir) throws IOException, FTPException
FTPClientInterface
mkdir
in interface FTPClientInterface
dir
- name of remote directory to
create
IOException
FTPException
public void chdir(String dir) throws IOException, FTPException
FTPClientInterface
chdir
in interface FTPClientInterface
dir
- name of remote directory to
change to
IOException
FTPException
public void cdup() throws IOException, FTPException
FTPClientInterface
cdup
in interface FTPClientInterface
IOException
FTPException
public Date modtime(String remoteFile) throws IOException, FTPException
FTPClientInterface
modtime
in interface FTPClientInterface
remoteFile
- name of remote file
IOException
FTPException
public String pwd() throws IOException, FTPException
FTPClientInterface
pwd
in interface FTPClientInterface
IOException
FTPException
public String[] features() throws IOException, FTPException
IOException
FTPException
public String system() throws IOException, FTPException
IOException
FTPException
public void noOperation() throws IOException, FTPException
IOException
FTPException
public String stat() throws IOException, FTPException
IOException
FTPException
public void sendServerWakeup() throws IOException, FTPException
IOException
FTPException
public void keepAlive() throws IOException, FTPException
keepAlive
in interface FTPClientInterface
IOException
FTPException
public String help(String command) throws IOException, FTPException
command
- name of the command to get help on
IOException
FTPException
protected void abort() throws IOException, FTPException
IOException
FTPException
public void quit() throws IOException, FTPException
FTPClientInterface
quit
in interface FTPClientInterface
IOException
FTPException
public void quitImmediately() throws IOException, FTPException
FTPClientInterface
quitImmediately
in interface FTPClientInterface
IOException
FTPException
public String toString()
toString
in class Object
|
edtFTPj | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |