public class WaarpFtpClient extends Object implements WaarpFtpClientInterface
Modifier and Type | Field and Description |
---|---|
protected String |
directory |
protected org.apache.commons.net.ftp.FTPClient |
ftpClient |
protected String |
ipAddress |
protected static WaarpLogger |
logger
Internal Logger
|
protected String |
result |
CANNOT_EXECUTE_OPERATION_FEATURE, CANNOT_EXECUTE_OPERATION_SITE, CANNOT_FINALIZE_RETRIEVE_LIKE_OPERATION, CANNOT_FINALIZE_STORE_LIKE_OPERATION, CANNOT_FINALIZE_TRANSFER_OPERATION, CHDIR_IN_ERROR, CONNECTION_IN_ERROR, DISCONNECTION_IN_ERROR, FILE_TYPE_IN_ERROR, LOGIN_IN_ERROR, MKDIR_IN_ERROR, NOOP_ERROR, SET_BINARY_IN_ERROR
Constructor and Description |
---|
WaarpFtpClient(String server,
int port,
String user,
String pwd,
String acct,
boolean isPassive,
int ssl,
int controlTimeout,
int timeout)
WARNING: SSL mode (FTPS and FTPSE) are not working due to a bug in Apache
Commons-Net
|
WaarpFtpClient(String server,
int port,
String user,
String pwd,
String acct,
boolean isPassive,
int ssl,
int controlTimeout,
int timeout,
boolean trace)
WARNING: SSL mode (FTPS and FTPSE) are not working due to a bug in Apache
Commons-Net
|
Modifier and Type | Method and Description |
---|---|
boolean |
append(InputStream local,
String remote)
Store File as Append
|
boolean |
append(String local,
String remote)
Store File as Append
|
boolean |
changeDir(String newDir)
Change remote directory
|
boolean |
changeFileType(boolean binaryTransfer)
Change the FileType of Transfer (Binary true, ASCII false)
|
void |
changeMode(boolean passive)
Change to passive (true) or active (false) mode
|
void |
compressionMode(boolean compression)
Change to ZLIB compression (true) or inactive (false) mode.
|
boolean |
connect()
Try to connect to the server and goes with the authentication
|
boolean |
deleteFile(String remote) |
void |
disconnect()
Disconnect the Ftp Client
|
String[] |
executeCommand(String params) |
String[] |
executeSiteCommand(String params) |
boolean |
featureEnabled(String feature) |
String[] |
features() |
String |
getResult() |
String[] |
listFiles() |
String[] |
listFiles(String remote) |
void |
logout()
QUIT the control connection
|
boolean |
makeDir(String newDir)
Create a new directory
|
String[] |
mlistFiles() |
String[] |
mlistFiles(String remote) |
void |
noop()
Sends a No Op command
|
boolean |
retrieve(OutputStream local,
String remote)
Retrieve File
|
boolean |
retrieve(String local,
String remote)
Retrieve File
|
void |
setActiveDataTransferPortRange(int from,
int to) |
void |
setReportActiveExternalIPAddress(String ipAddress) |
boolean |
store(InputStream local,
String remote)
Store File
|
boolean |
store(String local,
String remote)
Store File
|
boolean |
transferFile(InputStream local,
String remote,
int getStoreOrAppend)
Ask to transfer a file as STORE or APPEND
|
boolean |
transferFile(OutputStream local,
String remote)
Ask to transfer a file as GET
|
boolean |
transferFile(String local,
String remote,
int getStoreOrAppend)
Ask to transfer a file
|
protected static final WaarpLogger logger
protected final org.apache.commons.net.ftp.FTPClient ftpClient
protected String result
protected String directory
protected String ipAddress
public WaarpFtpClient(String server, int port, String user, String pwd, String acct, boolean isPassive, int ssl, int controlTimeout, int timeout)
server
- port
- user
- pwd
- acct
- isPassive
- ssl
- timeout
- public WaarpFtpClient(String server, int port, String user, String pwd, String acct, boolean isPassive, int ssl, int controlTimeout, int timeout, boolean trace)
server
- port
- user
- pwd
- acct
- isPassive
- ssl
- timeout
- public void setReportActiveExternalIPAddress(String ipAddress)
setReportActiveExternalIPAddress
in interface WaarpFtpClientInterface
ipAddress
- the external IP address to report in EPRT/PORT commands
in active mode.public void setActiveDataTransferPortRange(int from, int to)
setActiveDataTransferPortRange
in interface WaarpFtpClientInterface
from
- the first port to usedto
- the last port to usedpublic final String getResult()
getResult
in interface WaarpFtpClientInterface
public final boolean connect()
WaarpFtpClientInterface
connect
in interface WaarpFtpClientInterface
public final void logout()
WaarpFtpClientInterface
logout
in interface WaarpFtpClientInterface
public final void disconnect()
WaarpFtpClientInterface
disconnect
in interface WaarpFtpClientInterface
public final boolean makeDir(String newDir)
WaarpFtpClientInterface
makeDir
in interface WaarpFtpClientInterface
public final boolean changeDir(String newDir)
WaarpFtpClientInterface
changeDir
in interface WaarpFtpClientInterface
public final boolean changeFileType(boolean binaryTransfer)
WaarpFtpClientInterface
changeFileType
in interface WaarpFtpClientInterface
public final void changeMode(boolean passive)
WaarpFtpClientInterface
changeMode
in interface WaarpFtpClientInterface
public void compressionMode(boolean compression)
WaarpFtpClientInterface
compressionMode
in interface WaarpFtpClientInterface
public final boolean store(String local, String remote)
WaarpFtpClientInterface
store
in interface WaarpFtpClientInterface
local
- local filepath (full path)remote
- filename (basename)public final boolean store(InputStream local, String remote)
WaarpFtpClientInterface
store
in interface WaarpFtpClientInterface
local
- local InputStreamremote
- filename (basename)public final boolean append(String local, String remote)
WaarpFtpClientInterface
append
in interface WaarpFtpClientInterface
local
- local filepath (full path)remote
- filename (basename)public final boolean append(InputStream local, String remote)
WaarpFtpClientInterface
append
in interface WaarpFtpClientInterface
local
- local InputStreamremote
- filename (basename)public final boolean retrieve(String local, String remote)
WaarpFtpClientInterface
retrieve
in interface WaarpFtpClientInterface
local
- local filepath (full path)remote
- filename (basename)public final boolean retrieve(OutputStream local, String remote)
WaarpFtpClientInterface
retrieve
in interface WaarpFtpClientInterface
local
- local OutputStreamremote
- filename (basename)public final boolean transferFile(String local, String remote, int getStoreOrAppend)
WaarpFtpClientInterface
transferFile
in interface WaarpFtpClientInterface
local
- local filepath (full path)remote
- filename (basename)getStoreOrAppend
- -1 = get, 1 = store, 2 = appendpublic final boolean transferFile(InputStream local, String remote, int getStoreOrAppend)
WaarpFtpClientInterface
transferFile
in interface WaarpFtpClientInterface
local
- local outputStreamremote
- filename (basename)getStoreOrAppend
- 1 = store, 2 = appendpublic final boolean transferFile(OutputStream local, String remote)
WaarpFtpClientInterface
transferFile
in interface WaarpFtpClientInterface
local
- local outputStream (or NullStream)remote
- filename (basename)public final String[] listFiles(String remote)
listFiles
in interface WaarpFtpClientInterface
remote
- remote file specpublic final String[] listFiles()
listFiles
in interface WaarpFtpClientInterface
public final String[] mlistFiles(String remote)
mlistFiles
in interface WaarpFtpClientInterface
remote
- remote file specpublic final String[] mlistFiles()
mlistFiles
in interface WaarpFtpClientInterface
public final String[] features()
features
in interface WaarpFtpClientInterface
public final boolean featureEnabled(String feature)
featureEnabled
in interface WaarpFtpClientInterface
public boolean deleteFile(String remote)
deleteFile
in interface WaarpFtpClientInterface
public final String[] executeCommand(String params)
executeCommand
in interface WaarpFtpClientInterface
public final String[] executeSiteCommand(String params)
executeSiteCommand
in interface WaarpFtpClientInterface
params
- command without SITE in frontpublic final void noop()
WaarpFtpClientInterface
noop
in interface WaarpFtpClientInterface
Copyright © 2009–2022 Waarp. All rights reserved.