public class FtpsClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char |
DATA_CLEAR |
static char |
DATA_CONFIDENTIAL |
static char |
DATA_PRIVATE |
static char |
DATA_SAFE |
static int |
DEFAULT_DATA_PORT
The FTP data default port
|
static int |
DEFAULT_PORT
The FTP default port
|
static java.lang.String |
EOL
The FTP end-of-line symbols
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
The FTP ABOR command.
|
void |
account(java.lang.String account)
The FTP ACCT command.
|
void |
allocate(int size)
The FTP ALLO command.
|
void |
allocate(int size,
int optionsSize)
The FTP ALLO command.
|
java.net.Socket |
append(java.lang.String fileName)
The FTP APPE command.
|
void |
authorize(java.lang.String method)
The FTP AUTH TLS command.
|
void |
bufferSize()
The FTP PBSZ 0 command.
|
void |
changeToParentDirectory()
The FTP CDUPcommand.
|
void |
changeWorkingDirectory(java.lang.String directory)
The FTP CWD command.
|
void |
clear()
The FTP CCC command.
|
void |
close()
Closes the current client.
|
void |
dataPort(com.jscape.inet.util.ServerSocketUtil.PortRange range)
The FTP PORT command.
|
void |
delete(java.lang.String fileName)
The FTP DELE command.
|
void |
fileStructure(char fileStructure)
The FTP STRU command.
|
boolean |
getAutoDetectIpv6()
Get auto detect Ipv6 detection mode.
|
boolean |
getConnectBeforeCommand()
Gets the connectBefore indicator
|
FtpsCertificateVerifier |
getFtpsCertificateVerifier() |
Response |
getLastResponse()
Obtains the last server response.
|
java.lang.String |
getNATAddress()
Get NAT address.
|
java.lang.String |
getPortAddress()
Gets the external address to use when using active connections
using the PORT command.
|
javax.net.ssl.HandshakeCompletedListener |
getSslHandshakeCompletedListener()
Returns the current SSL handshake listener.
|
boolean |
getUseEPRT()
Gets use EPRT value.
|
boolean |
getUseEPSV()
Gets use EPSV value.
|
java.lang.String |
help(java.lang.String option)
The FTP HELP command.
|
boolean |
isClosed()
Checks if the current client is closed.
|
boolean |
isShutdownCCC()
Gets whether SSL connection should be shutdown after successfully issuing
CCC command.
|
java.net.Socket |
list(java.lang.String path)
The FTP LIST command.
|
void |
makeDirectory(java.lang.String directoryName)
The FTP MKD command.
|
java.net.Socket |
mlsd(java.lang.String dirname) |
java.net.Socket |
nameList(java.lang.String path)
The FTP NLST command.
|
Response |
noop()
The FTP NOOP command.
|
static FtpsClient |
openPlain(Ftps source,
com.jscape.inet.util.ConnectionParameters connectionParameters,
javax.net.ssl.SSLContext sslContext,
java.lang.String[] enabledCiphers,
java.util.logging.Logger logger) |
static FtpsClient |
openProtected(Ftps source,
com.jscape.inet.util.ConnectionParameters connectionParameters,
javax.net.ssl.SSLContext sslContext,
java.lang.String[] enabledCiphers,
java.util.logging.Logger logger) |
void |
passive(boolean firewall)
The FTP PASV command.
|
Response |
password(java.lang.String password)
The FTP PASS command.
|
java.lang.String |
printWorkingDirectory()
The FTP PWD command.
|
void |
protectionLevel(char level)
The FTP PROT command.
|
void |
quit()
The FTP QUIT command.
|
Response |
readResponse()
Reads the server response skipping all preliminary responses.
|
void |
reinitialize()
The FTP REIN command.
|
void |
removeDirectory(java.lang.String directoryName)
The FTP RMD command.
|
void |
rename(java.lang.String oldName,
java.lang.String newName)
The FTP RNFR and RNTO commands.
|
void |
representationType(java.lang.String type)
The FTP TYPE command.
|
void |
restart(java.lang.String serverMarker)
The FTP REST command.
|
java.net.Socket |
retrieve(java.lang.String fileName)
The FTP RETR command.
|
void |
sendCommand(java.lang.String command)
Sends command to the server.
|
Response |
sendRequest(java.lang.String command)
Sends the request to the server.
|
void |
setAutoDetectIpv6(boolean value)
Set auto detect Ipv6 detection mode.
|
void |
setConnectBeforeCommand(boolean connect)
Sets the connectBefore property value
|
void |
setFtpsCertificateVerifier(FtpsCertificateVerifier certificateVerifier) |
void |
setNATAddress(java.lang.String ipAddress)
Sets a NAT address which will be used after PASV command.
|
void |
setPortAddress(java.lang.String string)
Sets the external address to use when using active connections
using the PORT command.
|
void |
setReceiveBufferSize(int receiveBufferSize)
Sets the receive buffer size option of the ftps connection.
|
void |
setSendBufferSize(int sendBufferSize)
Sets the send buffer size option of the ftps connection.
|
void |
setShutdownCCC(boolean shutdownCCC)
Sets whether SSL connection should be shutdown after successfully issuing
CCC command.
|
void |
setSslHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener value)
Sets a current SSL handshake listener.
|
void |
setUseEPRT(boolean useEPRT)
Sets use EPRT indicator.
|
void |
setUseEPSV(boolean useEPSV)
Sets use EPSV indicator.
|
java.lang.String |
siteParameters()
The FTP SITE command.
|
java.lang.String |
status(java.lang.String path)
The FTP STAT command.
|
java.net.Socket |
store(java.lang.String fileName)
The FTP STOR command.
|
java.net.Socket |
storeUnique(java.lang.String fileName)
The FTP STOU command.
|
void |
structureMount(java.lang.String structure)
The FTP SMNT command.
|
java.lang.String |
system()
The FTP SYST command.
|
void |
transferMode(java.lang.String mode)
The FTP TYPE command.
|
Response |
userName(java.lang.String name)
The FTP USER command.
|
public static final int DEFAULT_PORT
public static final int DEFAULT_DATA_PORT
public static final char DATA_CLEAR
public static final char DATA_SAFE
public static final char DATA_CONFIDENTIAL
public static final char DATA_PRIVATE
public static final java.lang.String EOL
public static FtpsClient openPlain(Ftps source, com.jscape.inet.util.ConnectionParameters connectionParameters, javax.net.ssl.SSLContext sslContext, java.lang.String[] enabledCiphers, java.util.logging.Logger logger) throws FtpException
FtpException
public static FtpsClient openProtected(Ftps source, com.jscape.inet.util.ConnectionParameters connectionParameters, javax.net.ssl.SSLContext sslContext, java.lang.String[] enabledCiphers, java.util.logging.Logger logger) throws FtpException
FtpException
public void close()
public void setAutoDetectIpv6(boolean value)
value
- a flagpublic boolean getAutoDetectIpv6()
public boolean isClosed()
true
if the client is closed;
false
otherwisepublic java.lang.String getPortAddress()
public void setPortAddress(java.lang.String string)
string
- an ip addresspublic void setConnectBeforeCommand(boolean connect)
connect
- It indicates if the connection will be established before
send the commandpublic void setNATAddress(java.lang.String ipAddress) throws FtpException
ipAddress
- The NAT IP address.FtpException
- If an error occurs.public java.lang.String getNATAddress()
public javax.net.ssl.HandshakeCompletedListener getSslHandshakeCompletedListener()
public void setSslHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener value)
value
- a current SSL handshake listenerpublic boolean getConnectBeforeCommand()
true
the connection will be establiched before send the commandpublic Response sendRequest(java.lang.String command) throws FtpException
command
- a FTP commandFtpException
- if an I/O or protocol error occurspublic Response getLastResponse()
public void sendCommand(java.lang.String command) throws FtpException
command
- a FTP commandFtpException
- if an I/O or protocol error occurspublic Response readResponse() throws FtpException
FtpException
- if an I/O or protocol error occurspublic boolean isShutdownCCC()
true
to shutdown, false
otherwisepublic void setShutdownCCC(boolean shutdownCCC)
shutdownCCC
- true
to shutdown, false
otherwisepublic void setUseEPSV(boolean useEPSV)
useEPSV
- The use EPSV valuepublic boolean getUseEPSV()
true
the pasive mode will be sent EPSV commandpublic void setUseEPRT(boolean useEPRT)
useEPRT
- The use EPRT valuepublic boolean getUseEPRT()
true
the active mode will be sent EPRT commandpublic Response userName(java.lang.String name) throws FtpException
name
- user nameFtpException
- if an I/O or protocol error occurspublic Response password(java.lang.String password) throws FtpException
password
- the passwordFtpException
- if an I/O or protocol error occurspublic void account(java.lang.String account) throws FtpException
account
- the user accountFtpException
- if an I/O or protocol error occurspublic void changeWorkingDirectory(java.lang.String directory) throws FtpException
directory
- the target directory.FtpException
- if an I/O or protocol error occurspublic void changeToParentDirectory() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void structureMount(java.lang.String structure) throws FtpException
structure
- the structureFtpException
- if an I/O or protocol error occurspublic void reinitialize() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void quit() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void dataPort(com.jscape.inet.util.ServerSocketUtil.PortRange range) throws FtpException
range
- data port rangeFtpException
- if an I/O or protocol error occurspublic void passive(boolean firewall) throws FtpException
FtpException
- if an I/O or protocol error occurspublic void transferMode(java.lang.String mode) throws FtpException
mode
- the transfer modeFtpException
- if an I/O or protocol error occurspublic void representationType(java.lang.String type) throws FtpException
type
- the representation typeFtpException
- if an I/O or protocol error occurspublic void fileStructure(char fileStructure) throws FtpException
fileStructure
- the file structureFtpException
- if an I/O or protocol error occurspublic void allocate(int size) throws FtpException
size
- the sizeFtpException
- if an I/O or protocol error occurspublic void allocate(int size, int optionsSize) throws FtpException
size
- the sizeoptionsSize
- the options sizeFtpException
- if an I/O or protocol error occurspublic void restart(java.lang.String serverMarker) throws FtpException
serverMarker
- the server marker stringFtpException
- if an I/O or protocol error occurspublic java.net.Socket retrieve(java.lang.String fileName) throws FtpException
fileName
- the target file pathFtpException
- if an I/O or protocol error occurspublic java.net.Socket store(java.lang.String fileName) throws FtpException
fileName
- the target file pathFtpException
- if an I/O or protocol error occurspublic java.net.Socket storeUnique(java.lang.String fileName) throws FtpException
fileName
- a file nameFtpException
- if an I/O or protocol error occurspublic java.net.Socket append(java.lang.String fileName) throws FtpException
fileName
- the target file pathFtpException
- if an I/O or protocol error occurspublic void rename(java.lang.String oldName, java.lang.String newName) throws FtpException
oldName
- the old file namenewName
- the new file nameFtpException
- if an I/O or protocol error occurspublic void abort() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void delete(java.lang.String fileName) throws FtpException
fileName
- the target file nameFtpException
- if an I/O or protocol error occurspublic void removeDirectory(java.lang.String directoryName) throws FtpException
directoryName
- the target directory nameFtpException
- if an I/O or protocol error occurspublic void makeDirectory(java.lang.String directoryName) throws FtpException
directoryName
- the target directory nameFtpException
- if an I/O or protocol error occurspublic java.lang.String printWorkingDirectory() throws FtpException
FtpException
- if an I/O or protocol error occurspublic java.net.Socket list(java.lang.String path) throws FtpException
path
- the directory pathFtpException
- if an I/O or protocol error occurspublic java.net.Socket nameList(java.lang.String path) throws FtpException
path
- the directory pathFtpException
- if an I/O or protocol error occurspublic java.lang.String siteParameters() throws FtpException
FtpException
- if an I/O or protocol error occurspublic java.lang.String system() throws FtpException
FtpException
- if an I/O or protocol error occurspublic java.lang.String status(java.lang.String path) throws FtpException
path
- the file pathFtpException
- if an I/O or protocol error occurspublic java.lang.String help(java.lang.String option) throws FtpException
option
- the command optionFtpException
- if an I/O or protocol error occurspublic Response noop() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void authorize(java.lang.String method) throws FtpException
method
- an authorization methodFtpException
- if an I/O or protocol error occurspublic void clear() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void bufferSize() throws FtpException
FtpException
- if an I/O or protocol error occurspublic void protectionLevel(char level) throws FtpException
level
- the protection levelFtpException
- if an I/O or protocol error occurspublic void setSendBufferSize(int sendBufferSize)
sendBufferSize
- Send buffer size.public void setReceiveBufferSize(int receiveBufferSize)
receiveBufferSize
- Receive buffer size.public java.net.Socket mlsd(java.lang.String dirname) throws FtpException
FtpException
public FtpsCertificateVerifier getFtpsCertificateVerifier()
public void setFtpsCertificateVerifier(FtpsCertificateVerifier certificateVerifier)
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved