| Method from org.apache.commons.net.ftp.FTP Detail: |
protected void _connectAction_() throws IOException {
super._connectAction_();
_controlInput_ =
new BufferedReader(new InputStreamReader(_socket_.getInputStream(),
getControlEncoding()));
_controlOutput_ =
new BufferedWriter(new OutputStreamWriter(_socket_.getOutputStream(),
getControlEncoding()));
__getReply();
// If we received code 120, we have to fetch completion reply.
if (FTPReply.isPositivePreliminary(_replyCode))
__getReply();
}
|
public int abor() throws IOException {
return sendCommand(FTPCommand.ABOR);
}
A convenience method to send the FTP ABOR command to the server,
receive the reply, and return the reply code.
|
public int acct(String account) throws IOException {
return sendCommand(FTPCommand.ACCT, account);
}
A convenience method to send the FTP ACCT command to the server,
receive the reply, and return the reply code.
|
public void addProtocolCommandListener(ProtocolCommandListener listener) {
_commandSupport_.addProtocolCommandListener(listener);
}
|
public int allo(int bytes) throws IOException {
return sendCommand(FTPCommand.ALLO, Integer.toString(bytes));
}
A convenience method to send the FTP ALLO command to the server,
receive the reply, and return the reply code.
|
public int allo(int bytes,
int recordSize) throws IOException {
return sendCommand(FTPCommand.ALLO, Integer.toString(bytes) + " R " +
Integer.toString(recordSize));
}
A convenience method to send the FTP ALLO command to the server,
receive the reply, and return the reply code.
|
public int appe(String pathname) throws IOException {
return sendCommand(FTPCommand.APPE, pathname);
}
A convenience method to send the FTP APPE command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int cdup() throws IOException {
return sendCommand(FTPCommand.CDUP);
}
A convenience method to send the FTP CDUP command to the server,
receive the reply, and return the reply code.
|
public int cwd(String directory) throws IOException {
return sendCommand(FTPCommand.CWD, directory);
}
A convenience method to send the FTP CWD command to the server,
receive the reply, and return the reply code.
|
public int dele(String pathname) throws IOException {
return sendCommand(FTPCommand.DELE, pathname);
}
A convenience method to send the FTP DELE command to the server,
receive the reply, and return the reply code.
|
public void disconnect() throws IOException {
super.disconnect();
_controlInput_ = null;
_controlOutput_ = null;
_newReplyString = false;
_replyString = null;
}
Closes the control connection to the FTP server and sets to null
some internal data so that the memory may be reclaimed by the
garbage collector. The reply text and code information from the
last command is voided so that the memory it used may be reclaimed.
Also sets #_controlInput_ and #_controlOutput_ to null.
|
public String getControlEncoding() {
return _controlEncoding;
}
|
public int getReply() throws IOException {
__getReply();
return _replyCode;
}
Fetches a reply from the FTP server and returns the integer reply
code. After calling this method, the actual reply text can be accessed
from either calling getReplyString or
getReplyStrings . Only use this
method if you are implementing your own FTP client or if you need to
fetch a secondary response from the FTP server.
|
public int getReplyCode() {
return _replyCode;
}
Returns the integer value of the reply code of the last FTP reply.
You will usually only use this method after you connect to the
FTP server to check that the connection was successful since
connect is of type void.
|
public String getReplyString() {
StringBuilder buffer;
if (!_newReplyString) {
return _replyString;
}
buffer = new StringBuilder(256);
for (String line : _replyLines) {
buffer.append(line);
buffer.append(SocketClient.NETASCII_EOL);
}
_newReplyString = false;
return (_replyString = buffer.toString());
}
Returns the entire text of the last FTP server response exactly
as it was received, including all end of line markers in NETASCII
format.
|
public String[] getReplyStrings() {
String[] lines;
lines = new String[_replyLines.size()];
_replyLines.addAll(Arrays.asList(lines));
return lines;
}
Returns the lines of text from the last FTP server response as an array
of strings, one entry per line. The end of line markers of each are
stripped from each line.
|
public int help() throws IOException {
return sendCommand(FTPCommand.HELP);
}
A convenience method to send the FTP HELP command to the server,
receive the reply, and return the reply code.
|
public int help(String command) throws IOException {
return sendCommand(FTPCommand.HELP, command);
}
A convenience method to send the FTP HELP command to the server,
receive the reply, and return the reply code.
|
public boolean isStrictMultilineParsing() {
return strictMultilineParsing;
}
Return whether strict multiline parsing is enabled, as per RFX 959, section 4.2. |
public int list() throws IOException {
return sendCommand(FTPCommand.LIST);
}
A convenience method to send the FTP LIST command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int list(String pathname) throws IOException {
return sendCommand(FTPCommand.LIST, pathname);
}
A convenience method to send the FTP LIST command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int mdtm(String file) throws IOException {
return sendCommand(FTPCommand.MDTM, file);
}
|
public int mkd(String pathname) throws IOException {
return sendCommand(FTPCommand.MKD, pathname);
}
A convenience method to send the FTP MKD command to the server,
receive the reply, and return the reply code.
|
public int mode(int mode) throws IOException {
return sendCommand(FTPCommand.MODE,
__modes.substring(mode, mode + 1));
}
A convenience method to send the FTP MODE command to the server,
receive the reply, and return the reply code.
|
public int nlst() throws IOException {
return sendCommand(FTPCommand.NLST);
}
A convenience method to send the FTP NLST command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int nlst(String pathname) throws IOException {
return sendCommand(FTPCommand.NLST, pathname);
}
A convenience method to send the FTP NLST command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int noop() throws IOException {
return sendCommand(FTPCommand.NOOP);
}
A convenience method to send the FTP NOOP command to the server,
receive the reply, and return the reply code.
|
public int pass(String password) throws IOException {
return sendCommand(FTPCommand.PASS, password);
}
A convenience method to send the FTP PASS command to the server,
receive the reply, and return the reply code. |
public int pasv() throws IOException {
return sendCommand(FTPCommand.PASV);
}
A convenience method to send the FTP PASV command to the server,
receive the reply, and return the reply code. Remember, it's up
to you to interpret the reply string containing the host/port
information.
|
public int port(InetAddress host,
int port) throws IOException {
int num;
StringBuffer info = new StringBuffer(24);
info.append(host.getHostAddress().replace('.', ','));
num = port > > > 8;
info.append(',');
info.append(num);
info.append(',');
num = port & 0xff;
info.append(num);
return sendCommand(FTPCommand.PORT, info.toString());
}
A convenience method to send the FTP PORT command to the server,
receive the reply, and return the reply code.
|
public int pwd() throws IOException {
return sendCommand(FTPCommand.PWD);
}
A convenience method to send the FTP PWD command to the server,
receive the reply, and return the reply code.
|
public int quit() throws IOException {
return sendCommand(FTPCommand.QUIT);
}
A convenience method to send the FTP QUIT command to the server,
receive the reply, and return the reply code.
|
public int rein() throws IOException {
return sendCommand(FTPCommand.REIN);
}
A convenience method to send the FTP REIN command to the server,
receive the reply, and return the reply code.
|
public void removeProtocolCommandListener(ProtocolCommandListener listener) {
_commandSupport_.removeProtocolCommandListener(listener);
}
|
public int rest(String marker) throws IOException {
return sendCommand(FTPCommand.REST, marker);
}
A convenience method to send the FTP REST command to the server,
receive the reply, and return the reply code.
|
public int retr(String pathname) throws IOException {
return sendCommand(FTPCommand.RETR, pathname);
}
A convenience method to send the FTP RETR command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int rmd(String pathname) throws IOException {
return sendCommand(FTPCommand.RMD, pathname);
}
A convenience method to send the FTP RMD command to the server,
receive the reply, and return the reply code.
|
public int rnfr(String pathname) throws IOException {
return sendCommand(FTPCommand.RNFR, pathname);
}
A convenience method to send the FTP RNFR command to the server,
receive the reply, and return the reply code.
|
public int rnto(String pathname) throws IOException {
return sendCommand(FTPCommand.RNTO, pathname);
}
A convenience method to send the FTP RNTO command to the server,
receive the reply, and return the reply code.
|
public int sendCommand(String command) throws IOException {
return sendCommand(command, null);
}
Sends an FTP command with no arguments to the server, waits for a
reply and returns the numerical response code. After invocation, for
more detailed information, the actual reply text can be accessed by
calling getReplyString or
getReplyStrings .
|
public int sendCommand(int command) throws IOException {
return sendCommand(command, null);
}
Sends an FTP command with no arguments to the server, waits for a
reply and returns the numerical response code. After invocation, for
more detailed information, the actual reply text can be accessed by
calling getReplyString or
getReplyStrings .
|
public int sendCommand(String command,
String args) throws IOException {
String message;
__commandBuffer.setLength(0);
__commandBuffer.append(command);
if (args != null)
{
__commandBuffer.append(' ');
__commandBuffer.append(args);
}
__commandBuffer.append(SocketClient.NETASCII_EOL);
try{
_controlOutput_.write(message = __commandBuffer.toString());
_controlOutput_.flush();
}
catch (SocketException e)
{
if (!isConnected() || !socketIsConnected(_socket_))
{
throw new FTPConnectionClosedException("Connection unexpectedly closed.");
}
else
{
throw e;
}
}
if (_commandSupport_.getListenerCount() > 0)
_commandSupport_.fireCommandSent(command, message);
__getReply();
return _replyCode;
}
Sends an FTP command to the server, waits for a reply and returns the
numerical response code. After invocation, for more detailed
information, the actual reply text can be accessed by calling
getReplyString or
getReplyStrings .
|
public int sendCommand(int command,
String args) throws IOException {
return sendCommand(FTPCommand._commands[command], args);
}
Sends an FTP command to the server, waits for a reply and returns the
numerical response code. After invocation, for more detailed
information, the actual reply text can be accessed by calling
getReplyString or
getReplyStrings .
|
public void setControlEncoding(String encoding) {
_controlEncoding = encoding;
}
Sets the character encoding used by the FTP control connection.
Some FTP servers require that commands be issued in a non-ASCII
encoding like UTF-8 so that filenames with multi-byte character
representations (e.g, Big 8) can be specified. |
public void setStrictMultilineParsing(boolean strictMultilineParsing) {
this.strictMultilineParsing = strictMultilineParsing;
}
Set strict multiline parsing. |
public int site(String parameters) throws IOException {
return sendCommand(FTPCommand.SITE, parameters);
}
A convenience method to send the FTP SITE command to the server,
receive the reply, and return the reply code.
|
public int smnt(String dir) throws IOException {
return sendCommand(FTPCommand.SMNT, dir);
}
A convenience method to send the FTP SMNT command to the server,
receive the reply, and return the reply code.
|
public int stat() throws IOException {
return sendCommand(FTPCommand.STAT);
}
A convenience method to send the FTP STAT command to the server,
receive the reply, and return the reply code.
|
public int stat(String pathname) throws IOException {
return sendCommand(FTPCommand.STAT, pathname);
}
A convenience method to send the FTP STAT command to the server,
receive the reply, and return the reply code.
|
public int stor(String pathname) throws IOException {
return sendCommand(FTPCommand.STOR, pathname);
}
A convenience method to send the FTP STOR command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int stou() throws IOException {
return sendCommand(FTPCommand.STOU);
}
A convenience method to send the FTP STOU command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you.
|
public int stou(String pathname) throws IOException {
return sendCommand(FTPCommand.STOU, pathname);
}
A convenience method to send the FTP STOU command to the server,
receive the reply, and return the reply code. Remember, it is up
to you to manage the data connection. If you don't need this low
level of access, use org.apache.commons.net.ftp.FTPClient
, which will handle all low level details for you. |
public int stru(int structure) throws IOException {
return sendCommand(FTPCommand.STRU,
__modes.substring(structure, structure + 1));
}
A convenience method to send the FTP STRU command to the server,
receive the reply, and return the reply code.
|
public int syst() throws IOException {
return sendCommand(FTPCommand.SYST);
}
A convenience method to send the FTP SYST command to the server,
receive the reply, and return the reply code.
|
public int type(int fileType) throws IOException {
return sendCommand(FTPCommand.TYPE,
__modes.substring(fileType, fileType + 1));
}
A convenience method to send the FTP TYPE command to the server,
receive the reply, and return the reply code.
|
public int type(int fileType,
int formatOrByteSize) throws IOException {
StringBuffer arg = new StringBuffer();
arg.append(__modes.charAt(fileType));
arg.append(' ');
if (fileType == LOCAL_FILE_TYPE)
arg.append(formatOrByteSize);
else
arg.append(__modes.charAt(formatOrByteSize));
return sendCommand(FTPCommand.TYPE, arg.toString());
}
A convenience method to send the FTP TYPE command for text files
to the server, receive the reply, and return the reply code. |
public int user(String username) throws IOException {
return sendCommand(FTPCommand.USER, username);
}
A convenience method to send the FTP USER command to the server,
receive the reply, and return the reply code.
|