|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
package org.apache.commons.net.ftp; |
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
|
import java.io.BufferedWriter; |
|
|
|
|
import java.io.IOException; |
|
|
|
@ -92,8 +93,7 @@ import org.apache.commons.net.io.CRLFLineReader; |
|
|
|
|
* @version $Id: FTP.java 1782546 2017-02-11 00:05:41Z sebb $ |
|
|
|
|
***/ |
|
|
|
|
|
|
|
|
|
public class FTP extends SocketClient |
|
|
|
|
{ |
|
|
|
|
public class FTP extends SocketClient { |
|
|
|
|
/*** The default FTP data port (20). ***/ |
|
|
|
|
public static final int DEFAULT_DATA_PORT = 20; |
|
|
|
|
/*** The default FTP control port (21). ***/ |
|
|
|
@ -114,7 +114,6 @@ public class FTP extends SocketClient |
|
|
|
|
***/ |
|
|
|
|
public static final int EBCDIC_FILE_TYPE = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* A constant used to indicate the file(s) being transferred should |
|
|
|
|
* be treated as a binary image, i.e., no translations should be |
|
|
|
@ -266,8 +265,7 @@ public class FTP extends SocketClient |
|
|
|
|
* <code>DEFAULT_PORT</code> and initializes internal data structures |
|
|
|
|
* for saving FTP reply information. |
|
|
|
|
***/ |
|
|
|
|
public FTP() |
|
|
|
|
{ |
|
|
|
|
public FTP() { |
|
|
|
|
super(); |
|
|
|
|
setDefaultPort(DEFAULT_PORT); |
|
|
|
|
_replyLines = new ArrayList<String>(); |
|
|
|
@ -288,31 +286,30 @@ public class FTP extends SocketClient |
|
|
|
|
// test that the line starts with a digit rather than starting with
|
|
|
|
|
// the code.
|
|
|
|
|
private boolean __lenientCheck(String line) { |
|
|
|
|
return (!(line.length() > REPLY_CODE_LEN&& line.charAt(REPLY_CODE_LEN) != '-' && |
|
|
|
|
Character.isDigit(line.charAt(0)))); |
|
|
|
|
return (!(line.length() > REPLY_CODE_LEN |
|
|
|
|
&& line.charAt(REPLY_CODE_LEN) != '-' |
|
|
|
|
&& Character.isDigit(line.charAt(0)))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get the reply, and pass it to command listeners |
|
|
|
|
*/ |
|
|
|
|
private void __getReply() throws IOException |
|
|
|
|
{ |
|
|
|
|
private void __getReply() throws IOException { |
|
|
|
|
__getReply(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get the reply, but don't pass it to command listeners. |
|
|
|
|
* Used for keep-alive processing only. |
|
|
|
|
* @since 3.0 |
|
|
|
|
* |
|
|
|
|
* @throws IOException on error |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
protected void __getReplyNoReport() throws IOException |
|
|
|
|
{ |
|
|
|
|
protected void __getReplyNoReport() throws IOException { |
|
|
|
|
__getReply(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void __getReply(boolean reportReply) throws IOException |
|
|
|
|
{ |
|
|
|
|
private void __getReply(boolean reportReply) throws IOException { |
|
|
|
|
int length; |
|
|
|
|
|
|
|
|
|
_newReplyString = true; |
|
|
|
@ -321,26 +318,21 @@ public class FTP extends SocketClient |
|
|
|
|
String line = _controlInput_.readLine(); |
|
|
|
|
|
|
|
|
|
if (line == null) { |
|
|
|
|
throw new FTPConnectionClosedException( |
|
|
|
|
"Connection closed without indication."); |
|
|
|
|
throw new FTPConnectionClosedException("Connection closed without indication."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// In case we run into an anomaly we don't want fatal index exceptions
|
|
|
|
|
// to be thrown.
|
|
|
|
|
length = line.length(); |
|
|
|
|
if (length < REPLY_CODE_LEN) { |
|
|
|
|
throw new MalformedServerReplyException( |
|
|
|
|
"Truncated server reply: " + line); |
|
|
|
|
throw new MalformedServerReplyException("Truncated server reply: " + line); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String code = null; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
try { |
|
|
|
|
code = line.substring(0, REPLY_CODE_LEN); |
|
|
|
|
_replyCode = Integer.parseInt(code); |
|
|
|
|
} |
|
|
|
|
catch (NumberFormatException e) |
|
|
|
|
{ |
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
throw new MalformedServerReplyException( |
|
|
|
|
"Could not parse response code.\nServer Reply: " + line); |
|
|
|
|
} |
|
|
|
@ -352,13 +344,11 @@ public class FTP extends SocketClient |
|
|
|
|
char sep = line.charAt(REPLY_CODE_LEN); |
|
|
|
|
// Get extra lines if message continues.
|
|
|
|
|
if (sep == '-') { |
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
do { |
|
|
|
|
line = _controlInput_.readLine(); |
|
|
|
|
|
|
|
|
|
if (line == null) { |
|
|
|
|
throw new FTPConnectionClosedException( |
|
|
|
|
"Connection closed without indication."); |
|
|
|
|
throw new FTPConnectionClosedException("Connection closed without indication."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_replyLines.add(line); |
|
|
|
@ -366,9 +356,7 @@ public class FTP extends SocketClient |
|
|
|
|
// The length() check handles problems that could arise from readLine()
|
|
|
|
|
// returning too soon after encountering a naked CR or some other
|
|
|
|
|
// anomaly.
|
|
|
|
|
} |
|
|
|
|
while ( isStrictMultilineParsing() ? __strictCheck(line, code) : __lenientCheck(line)); |
|
|
|
|
|
|
|
|
|
} while (isStrictMultilineParsing() ? __strictCheck(line, code) : __lenientCheck(line)); |
|
|
|
|
} else if (isStrictReplyParsing()) { |
|
|
|
|
if (length == REPLY_CODE_LEN + 1) { // expecting some text
|
|
|
|
|
throw new MalformedServerReplyException("Truncated server reply: '" + line + "'"); |
|
|
|
@ -385,7 +373,8 @@ public class FTP extends SocketClient |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (_replyCode == FTPReply.SERVICE_NOT_AVAILABLE) { |
|
|
|
|
throw new FTPConnectionClosedException("FTP response 421 received. Server closed connection."); |
|
|
|
|
throw new FTPConnectionClosedException( |
|
|
|
|
"FTP response 421 received. Server closed connection."); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -393,13 +382,10 @@ public class FTP extends SocketClient |
|
|
|
|
* Initiates control connections and gets initial reply. |
|
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
protected void _connectAction_() throws IOException |
|
|
|
|
{ |
|
|
|
|
@Override protected void _connectAction_() throws IOException { |
|
|
|
|
_connectAction_(null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Initiates control connections and gets initial reply. |
|
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
|
@ -411,13 +397,11 @@ public class FTP extends SocketClient |
|
|
|
|
protected void _connectAction_(Reader socketIsReader) throws IOException { |
|
|
|
|
super._connectAction_(); // sets up _input_ and _output_
|
|
|
|
|
if (socketIsReader == null) { |
|
|
|
|
_controlInput_ = |
|
|
|
|
new CRLFLineReader(new InputStreamReader(_input_, getControlEncoding())); |
|
|
|
|
_controlInput_ = new CRLFLineReader(new InputStreamReader(_input_, getControlEncoding())); |
|
|
|
|
} else { |
|
|
|
|
_controlInput_ = new CRLFLineReader(socketIsReader); |
|
|
|
|
} |
|
|
|
|
_controlOutput_ = |
|
|
|
|
new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding())); |
|
|
|
|
_controlOutput_ = new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding())); |
|
|
|
|
if (connectTimeout > 0) { // NET-385
|
|
|
|
|
int original = _socket_.getSoTimeout(); |
|
|
|
|
_socket_.setSoTimeout(connectTimeout); |
|
|
|
@ -443,7 +427,6 @@ public class FTP extends SocketClient |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Saves the character encoding to be used by the FTP control connection. |
|
|
|
|
* Some FTP servers require that commands be issued in a non-ASCII |
|
|
|
@ -458,7 +441,6 @@ public class FTP extends SocketClient |
|
|
|
|
_controlEncoding = encoding; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return The character encoding used to communicate over the |
|
|
|
|
* control connection. |
|
|
|
@ -467,7 +449,6 @@ public class FTP extends SocketClient |
|
|
|
|
return _controlEncoding; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Closes the control connection to the FTP server and sets to null |
|
|
|
|
* some internal data so that the memory may be reclaimed by the |
|
|
|
@ -477,9 +458,7 @@ public class FTP extends SocketClient |
|
|
|
|
* |
|
|
|
|
* @throws IOException If an error occurs while disconnecting. |
|
|
|
|
***/ |
|
|
|
|
@Override |
|
|
|
|
public void disconnect() throws IOException |
|
|
|
|
{ |
|
|
|
|
@Override public void disconnect() throws IOException { |
|
|
|
|
super.disconnect(); |
|
|
|
|
_controlInput_ = null; |
|
|
|
|
_controlOutput_ = null; |
|
|
|
@ -487,7 +466,6 @@ public class FTP extends SocketClient |
|
|
|
|
_replyString = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Sends an FTP command to the server, waits for a reply and returns the |
|
|
|
|
* numerical response code. After invocation, for more detailed |
|
|
|
@ -508,8 +486,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int sendCommand(String command, String args) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int sendCommand(String command, String args) throws IOException { |
|
|
|
|
if (_controlOutput_ == null) { |
|
|
|
|
throw new IOException("Connection is not open"); |
|
|
|
|
} |
|
|
|
@ -529,8 +506,7 @@ public class FTP extends SocketClient |
|
|
|
|
|
|
|
|
|
__commandBuffer.append(command); |
|
|
|
|
|
|
|
|
|
if (args != null) |
|
|
|
|
{ |
|
|
|
|
if (args != null) { |
|
|
|
|
__commandBuffer.append(' '); |
|
|
|
|
__commandBuffer.append(args); |
|
|
|
|
} |
|
|
|
@ -538,20 +514,15 @@ public class FTP extends SocketClient |
|
|
|
|
return __commandBuffer.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void __send(String message) throws IOException, |
|
|
|
|
FTPConnectionClosedException, SocketException { |
|
|
|
|
private void __send(String message) |
|
|
|
|
throws IOException, FTPConnectionClosedException, SocketException { |
|
|
|
|
try { |
|
|
|
|
_controlOutput_.write(message); |
|
|
|
|
_controlOutput_.flush(); |
|
|
|
|
} |
|
|
|
|
catch (SocketException e) |
|
|
|
|
{ |
|
|
|
|
if (!isConnected()) |
|
|
|
|
{ |
|
|
|
|
} catch (SocketException e) { |
|
|
|
|
if (!isConnected()) { |
|
|
|
|
throw new FTPConnectionClosedException("Connection unexpectedly closed."); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
throw e; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -592,9 +563,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @deprecated (3.3) Use {@link #sendCommand(FTPCmd, String)} instead |
|
|
|
|
***/ |
|
|
|
|
@Deprecated |
|
|
|
|
public int sendCommand(int command, String args) throws IOException |
|
|
|
|
{ |
|
|
|
|
@Deprecated public int sendCommand(int command, String args) throws IOException { |
|
|
|
|
return sendCommand(FTPCommand.getCommand(command), args); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -609,8 +578,8 @@ public class FTP extends SocketClient |
|
|
|
|
* to send. |
|
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
|
* in response to the command. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -635,8 +604,8 @@ public class FTP extends SocketClient |
|
|
|
|
* set to null, then the command is sent with no argument. |
|
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
|
* in response to the command. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -666,12 +635,10 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int sendCommand(String command) throws IOException |
|
|
|
|
{ |
|
|
|
|
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 |
|
|
|
@ -691,12 +658,10 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int sendCommand(int command) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int sendCommand(int command) throws IOException { |
|
|
|
|
return sendCommand(command, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* 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 |
|
|
|
@ -705,8 +670,7 @@ public class FTP extends SocketClient |
|
|
|
|
* |
|
|
|
|
* @return The integer value of the reply code of the last FTP reply. |
|
|
|
|
***/ |
|
|
|
|
public int getReplyCode() |
|
|
|
|
{ |
|
|
|
|
public int getReplyCode() { |
|
|
|
|
return _replyCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -727,13 +691,11 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while receiving the |
|
|
|
|
* server reply. |
|
|
|
|
***/ |
|
|
|
|
public int getReply() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int getReply() throws IOException { |
|
|
|
|
__getReply(); |
|
|
|
|
return _replyCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* 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 |
|
|
|
@ -741,8 +703,7 @@ public class FTP extends SocketClient |
|
|
|
|
* |
|
|
|
|
* @return The lines of text from the last FTP response as an array. |
|
|
|
|
***/ |
|
|
|
|
public String[] getReplyStrings() |
|
|
|
|
{ |
|
|
|
|
public String[] getReplyStrings() { |
|
|
|
|
return _replyLines.toArray(new String[_replyLines.size()]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -753,8 +714,7 @@ public class FTP extends SocketClient |
|
|
|
|
* |
|
|
|
|
* @return The entire text from the last FTP response as a String. |
|
|
|
|
***/ |
|
|
|
|
public String getReplyString() |
|
|
|
|
{ |
|
|
|
|
public String getReplyString() { |
|
|
|
|
StringBuilder buffer; |
|
|
|
|
|
|
|
|
|
if (!_newReplyString) { |
|
|
|
@ -773,7 +733,6 @@ public class FTP extends SocketClient |
|
|
|
|
return (_replyString = buffer.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* A convenience method to send the FTP USER command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
@ -788,26 +747,25 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int user(String username) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int user(String username) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.USER, username); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A convenience method to send the FTP PASS command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
|
* |
|
|
|
|
* @param password The plain text password of the username being logged into. |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
*/ |
|
|
|
|
public int pass(String password) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int pass(String password) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.PASS, password); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -825,12 +783,10 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int acct(String account) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int acct(String account) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.ACCT, account); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* A convenience method to send the FTP ABOR command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
@ -844,8 +800,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int abor() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int abor() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.ABOR); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -863,8 +818,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int cwd(String directory) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int cwd(String directory) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.CWD, directory); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -881,8 +835,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int cdup() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int cdup() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.CDUP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -899,8 +852,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int quit() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int quit() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.QUIT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -917,8 +869,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int rein() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int rein() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.REIN); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -936,8 +887,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int smnt(String dir) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int smnt(String dir) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.SMNT, dir); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -956,8 +906,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int port(InetAddress host, int port) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int port(InetAddress host, int port) throws IOException { |
|
|
|
|
int num; |
|
|
|
|
StringBuilder info = new StringBuilder(24); |
|
|
|
|
|
|
|
|
@ -996,8 +945,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 2.2 |
|
|
|
|
***/ |
|
|
|
|
public int eprt(InetAddress host, int port) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int eprt(InetAddress host, int port) throws IOException { |
|
|
|
|
int num; |
|
|
|
|
StringBuilder info = new StringBuilder(); |
|
|
|
|
String h; |
|
|
|
@ -1040,8 +988,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int pasv() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int pasv() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.PASV); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1061,30 +1008,29 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 2.2 |
|
|
|
|
***/ |
|
|
|
|
public int epsv() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int epsv() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.EPSV); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A convenience method to send the FTP TYPE command for text files |
|
|
|
|
* to the server, receive the reply, and return the reply code. |
|
|
|
|
* |
|
|
|
|
* @param fileType The type of the file (one of the <code>FILE_TYPE</code> |
|
|
|
|
* constants). |
|
|
|
|
* @param formatOrByteSize The format of the file (one of the |
|
|
|
|
* <code>_FORMAT</code> constants. In the case of |
|
|
|
|
* <code>LOCAL_FILE_TYPE</code>, the byte size. |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
*/ |
|
|
|
|
public int type(int fileType, int formatOrByteSize) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int type(int fileType, int formatOrByteSize) throws IOException { |
|
|
|
|
StringBuilder arg = new StringBuilder(); |
|
|
|
|
|
|
|
|
|
arg.append(__modes.charAt(fileType)); |
|
|
|
@ -1098,7 +1044,6 @@ public class FTP extends SocketClient |
|
|
|
|
return sendCommand(FTPCmd.TYPE, arg.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A convenience method to send the FTP TYPE command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
@ -1106,18 +1051,16 @@ public class FTP extends SocketClient |
|
|
|
|
* @param fileType The type of the file (one of the <code>FILE_TYPE</code> |
|
|
|
|
* constants). |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
*/ |
|
|
|
|
public int type(int fileType) throws IOException |
|
|
|
|
{ |
|
|
|
|
return sendCommand(FTPCmd.TYPE, |
|
|
|
|
__modes.substring(fileType, fileType + 1)); |
|
|
|
|
public int type(int fileType) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.TYPE, __modes.substring(fileType, fileType + 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
@ -1135,10 +1078,8 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int stru(int structure) throws IOException |
|
|
|
|
{ |
|
|
|
|
return sendCommand(FTPCmd.STRU, |
|
|
|
|
__modes.substring(structure, structure + 1)); |
|
|
|
|
public int stru(int structure) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STRU, __modes.substring(structure, structure + 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
@ -1156,10 +1097,8 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int mode(int mode) throws IOException |
|
|
|
|
{ |
|
|
|
|
return sendCommand(FTPCmd.MODE, |
|
|
|
|
__modes.substring(mode, mode + 1)); |
|
|
|
|
public int mode(int mode) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MODE, __modes.substring(mode, mode + 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
@ -1179,8 +1118,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int retr(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int retr(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.RETR, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1202,8 +1140,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int stor(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int stor(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STOR, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1223,8 +1160,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int stou() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int stou() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STOU); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1246,8 +1182,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
*/ |
|
|
|
|
public int stou(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int stou(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STOU, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1269,8 +1204,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int appe(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int appe(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.APPE, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1288,21 +1222,20 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int allo(int bytes) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int allo(int bytes) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.ALLO, Integer.toString(bytes)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A convenience method to send the FTP FEAT command to the server, receive the reply, |
|
|
|
|
* and return the reply code. |
|
|
|
|
* |
|
|
|
|
* @return The reply code received by the server |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 2.2 |
|
|
|
|
*/ |
|
|
|
|
public int feat() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int feat() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.FEAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1321,10 +1254,8 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int allo(int bytes, int recordSize) throws IOException |
|
|
|
|
{ |
|
|
|
|
return sendCommand(FTPCmd.ALLO, Integer.toString(bytes) + " R " + |
|
|
|
|
Integer.toString(recordSize)); |
|
|
|
|
public int allo(int bytes, int recordSize) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.ALLO, Integer.toString(bytes) + " R " + Integer.toString(recordSize)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
@ -1341,24 +1272,20 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int rest(String marker) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int rest(String marker) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.REST, marker); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param file name of file |
|
|
|
|
* @return the status |
|
|
|
|
* @throws IOException on error |
|
|
|
|
* @since 2.0 |
|
|
|
|
**/ |
|
|
|
|
public int mdtm(String file) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mdtm(String file) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MDTM, file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A convenience method to send the FTP MFMT command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
@ -1366,22 +1293,20 @@ public class FTP extends SocketClient |
|
|
|
|
* @param pathname The pathname for which mtime is to be changed |
|
|
|
|
* @param timeval Timestamp in <code>YYYYMMDDhhmmss</code> format |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 2.2 |
|
|
|
|
* @see <a href="http://tools.ietf.org/html/draft-somers-ftp-mfxx-04">http://tools.ietf.org/html/draft-somers-ftp-mfxx-04</a>
|
|
|
|
|
* @since 2.2 |
|
|
|
|
**/ |
|
|
|
|
public int mfmt(String pathname, String timeval) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mfmt(String pathname, String timeval) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MFMT, timeval + " " + pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* A convenience method to send the FTP RNFR command to the server, |
|
|
|
|
* receive the reply, and return the reply code. |
|
|
|
@ -1396,8 +1321,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int rnfr(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int rnfr(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.RNFR, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1415,8 +1339,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int rnto(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int rnto(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.RNTO, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1434,8 +1357,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int dele(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int dele(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.DELE, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1453,8 +1375,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int rmd(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int rmd(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.RMD, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1472,8 +1393,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int mkd(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mkd(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MKD, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1490,8 +1410,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int pwd() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int pwd() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.PWD); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1511,8 +1430,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int list() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int list() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.LIST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1534,8 +1452,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int list(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int list(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.LIST, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1547,8 +1464,8 @@ public class FTP extends SocketClient |
|
|
|
|
* , which will handle all low level details for you. |
|
|
|
|
* |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -1556,8 +1473,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
public int mlsd() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mlsd() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MLSD); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1571,8 +1487,8 @@ public class FTP extends SocketClient |
|
|
|
|
* @param path the path to report on |
|
|
|
|
* @return The reply code received from the server, |
|
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -1580,8 +1496,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
public int mlsd(String path) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mlsd(String path) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MLSD, path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1593,8 +1508,8 @@ public class FTP extends SocketClient |
|
|
|
|
* , which will handle all low level details for you. |
|
|
|
|
* |
|
|
|
|
* @return The reply code received from the server. |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -1602,8 +1517,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
public int mlst() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mlst() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MLST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1617,8 +1531,8 @@ public class FTP extends SocketClient |
|
|
|
|
* @param path the path to report on |
|
|
|
|
* @return The reply code received from the server, |
|
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
|
* result |
|
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
|
* as an IOException or independently as itself. |
|
|
|
@ -1626,8 +1540,7 @@ public class FTP extends SocketClient |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
public int mlst(String path) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int mlst(String path) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.MLST, path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1647,8 +1560,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int nlst() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int nlst() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.NLST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1670,8 +1582,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int nlst(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int nlst(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.NLST, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1689,8 +1600,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int site(String parameters) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int site(String parameters) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.SITE, parameters); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1707,8 +1617,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int syst() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int syst() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.SYST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1725,8 +1634,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int stat() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int stat() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1744,8 +1652,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int stat(String pathname) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int stat(String pathname) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.STAT, pathname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1762,8 +1669,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int help() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int help() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.HELP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1781,8 +1687,7 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int help(String command) throws IOException |
|
|
|
|
{ |
|
|
|
|
public int help(String command) throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.HELP, command); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1799,13 +1704,13 @@ public class FTP extends SocketClient |
|
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
|
* command or receiving the server reply. |
|
|
|
|
***/ |
|
|
|
|
public int noop() throws IOException |
|
|
|
|
{ |
|
|
|
|
public int noop() throws IOException { |
|
|
|
|
return sendCommand(FTPCmd.NOOP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return whether strict multiline parsing is enabled, as per RFC 959, section 4.2. |
|
|
|
|
* |
|
|
|
|
* @return True if strict, false if lenient |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
@ -1815,6 +1720,7 @@ public class FTP extends SocketClient |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set strict multiline parsing. |
|
|
|
|
* |
|
|
|
|
* @param strictMultilineParsing the setting |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
@ -1829,6 +1735,7 @@ public class FTP extends SocketClient |
|
|
|
|
* <br> |
|
|
|
|
* If false, only the 3 digit code is required (as was the case for versions up to 3.5) |
|
|
|
|
* <br> |
|
|
|
|
* |
|
|
|
|
* @return True if strict (default), false if additional checks are not made |
|
|
|
|
* @since 3.6 |
|
|
|
|
*/ |
|
|
|
@ -1845,6 +1752,7 @@ public class FTP extends SocketClient |
|
|
|
|
* <p> |
|
|
|
|
* <b>This should not be required by a well-behaved FTP server</b> |
|
|
|
|
* <br> |
|
|
|
|
* |
|
|
|
|
* @param strictReplyParsing the setting |
|
|
|
|
* @since 3.6 |
|
|
|
|
*/ |
|
|
|
@ -1855,8 +1763,7 @@ public class FTP extends SocketClient |
|
|
|
|
/** |
|
|
|
|
* Provide command support to super-class
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
protected ProtocolCommandSupport getCommandSupport() { |
|
|
|
|
@Override protected ProtocolCommandSupport getCommandSupport() { |
|
|
|
|
return _commandSupport_; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|