public class FTPConnector extends java.lang.Object implements Connector
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_CWD |
static int |
ACTION_DEL |
static int |
ACTION_GET |
static int |
ACTION_LIST |
static int |
ACTION_MKD |
static int |
ACTION_PUT |
static int |
ACTION_PWD |
static int |
ACTION_RMD |
static int |
ACTION_SIZE |
static int |
ACTION_TIME |
static int |
FTP_ALL |
static int |
FTP_DIRECTORY |
static int |
FTP_FILE |
static int |
FTP_LINK |
static int |
FTP_UNKNOWN |
protected java.lang.String |
uri |
Constructor and Description |
---|
FTPConnector(java.util.Map props)
Creates new FTPConnector
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
completePendingCommand() |
protected void |
connect() |
java.lang.String |
createDirectory(java.lang.String dirname,
int retry)
It checks the existence of the directory tree on the server and creates
the missing ones if necessary.
|
boolean |
ftpCwd(java.lang.String pathname) |
boolean |
ftpDelete(java.lang.String pathname) |
java.lang.String |
ftpGet(java.io.File localFile,
java.lang.String filename) |
java.lang.String |
ftpGet(java.io.OutputStream out,
java.lang.String filename) |
java.lang.String |
ftpGet(java.lang.StringBuffer strBuf,
java.lang.String filename) |
java.lang.String[] |
ftpList(java.lang.String dirname,
int type)
It returns an array of strings for requested files of type.
|
boolean |
ftpMkd(java.lang.String pathname) |
boolean |
ftpNoOp() |
java.lang.String |
ftpPut(java.io.File localFile,
java.lang.String filename) |
java.lang.String |
ftpPut(java.io.InputStream in,
java.lang.String filename) |
java.lang.String |
ftpPut(java.lang.String payload,
java.lang.String filename) |
java.lang.String |
ftpPwd() |
boolean |
ftpRmd(java.lang.String pathname) |
org.apache.commons.net.ftp.FTPClient |
getFTPClient() |
static java.lang.String |
getParent(java.lang.String filename)
It returns dirname of the filename or null if it is a relative path.
|
int |
getReplyCode() |
java.lang.String |
getReplyString() |
long |
getSize(java.lang.String remote)
returns the file size or -1 in case of failure
|
long |
getTimestamp(java.lang.String remote)
returns the mtime or -1 in case of failure
|
java.lang.String |
getURI() |
boolean |
isConnected() |
static void |
main(java.lang.String[] args) |
java.lang.String |
reconnect()
It reconnects and returns null or error message upon failure
|
java.io.InputStream |
retrieveFileStream(java.lang.String remote) |
java.io.OutputStream |
storeFileStream(java.lang.String remote) |
protected java.lang.String uri
public static final int FTP_ALL
public static final int FTP_FILE
public static final int FTP_DIRECTORY
public static final int FTP_LINK
public static final int FTP_UNKNOWN
public static final int ACTION_PWD
public static final int ACTION_CWD
public static final int ACTION_MKD
public static final int ACTION_RMD
public static final int ACTION_LIST
public static final int ACTION_GET
public static final int ACTION_PUT
public static final int ACTION_DEL
public static final int ACTION_SIZE
public static final int ACTION_TIME
public FTPConnector(java.util.Map props) throws java.io.IOException
java.io.IOException
protected void connect() throws java.io.IOException
java.io.IOException
public boolean isConnected()
isConnected
in interface Connector
public java.lang.String reconnect()
public java.lang.String ftpGet(java.io.File localFile, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String ftpGet(java.lang.StringBuffer strBuf, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String ftpGet(java.io.OutputStream out, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String ftpPut(java.io.File localFile, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String ftpPut(java.lang.String payload, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String ftpPut(java.io.InputStream in, java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String[] ftpList(java.lang.String dirname, int type) throws java.io.IOException
java.io.IOException
public java.lang.String ftpPwd() throws java.io.IOException
java.io.IOException
public boolean ftpCwd(java.lang.String pathname) throws java.io.IOException
java.io.IOException
public boolean ftpMkd(java.lang.String pathname) throws java.io.IOException
java.io.IOException
public boolean ftpRmd(java.lang.String pathname) throws java.io.IOException
java.io.IOException
public boolean ftpDelete(java.lang.String pathname) throws java.io.IOException
java.io.IOException
public boolean ftpNoOp() throws java.io.IOException
java.io.IOException
public boolean completePendingCommand() throws java.io.IOException
java.io.IOException
public int getReplyCode() throws java.io.IOException
java.io.IOException
public java.lang.String getReplyString() throws java.io.IOException
java.io.IOException
public java.lang.String createDirectory(java.lang.String dirname, int retry) throws java.io.IOException
java.io.IOException
public static java.lang.String getParent(java.lang.String filename)
public org.apache.commons.net.ftp.FTPClient getFTPClient()
public java.io.InputStream retrieveFileStream(java.lang.String remote) throws java.io.IOException
java.io.IOException
public java.io.OutputStream storeFileStream(java.lang.String remote) throws java.io.IOException
java.io.IOException
public long getSize(java.lang.String remote) throws java.io.IOException
java.io.IOException
public long getTimestamp(java.lang.String remote) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)