|
|
@ -16,6 +16,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.commons.net.ftp; |
|
|
|
package org.apache.commons.net.ftp; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedWriter; |
|
|
|
import java.io.BufferedWriter; |
|
|
|
import java.io.IOException; |
|
|
|
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 $ |
|
|
|
* @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). ***/ |
|
|
|
/*** The default FTP data port (20). ***/ |
|
|
|
public static final int DEFAULT_DATA_PORT = 20; |
|
|
|
public static final int DEFAULT_DATA_PORT = 20; |
|
|
|
/*** The default FTP control port (21). ***/ |
|
|
|
/*** The default FTP control port (21). ***/ |
|
|
@ -114,7 +114,6 @@ public class FTP extends SocketClient |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public static final int EBCDIC_FILE_TYPE = 1; |
|
|
|
public static final int EBCDIC_FILE_TYPE = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* A constant used to indicate the file(s) being transferred should |
|
|
|
* A constant used to indicate the file(s) being transferred should |
|
|
|
* be treated as a binary image, i.e., no translations should be |
|
|
|
* 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 |
|
|
|
* <code>DEFAULT_PORT</code> and initializes internal data structures |
|
|
|
* for saving FTP reply information. |
|
|
|
* for saving FTP reply information. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public FTP() |
|
|
|
public FTP() { |
|
|
|
{ |
|
|
|
|
|
|
|
super(); |
|
|
|
super(); |
|
|
|
setDefaultPort(DEFAULT_PORT); |
|
|
|
setDefaultPort(DEFAULT_PORT); |
|
|
|
_replyLines = new ArrayList<String>(); |
|
|
|
_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
|
|
|
|
// test that the line starts with a digit rather than starting with
|
|
|
|
// the code.
|
|
|
|
// the code.
|
|
|
|
private boolean __lenientCheck(String line) { |
|
|
|
private boolean __lenientCheck(String line) { |
|
|
|
return (!(line.length() > REPLY_CODE_LEN&& line.charAt(REPLY_CODE_LEN) != '-' && |
|
|
|
return (!(line.length() > REPLY_CODE_LEN |
|
|
|
Character.isDigit(line.charAt(0)))); |
|
|
|
&& line.charAt(REPLY_CODE_LEN) != '-' |
|
|
|
|
|
|
|
&& Character.isDigit(line.charAt(0)))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the reply, and pass it to command listeners |
|
|
|
* Get the reply, and pass it to command listeners |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void __getReply() throws IOException |
|
|
|
private void __getReply() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
__getReply(true); |
|
|
|
__getReply(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the reply, but don't pass it to command listeners. |
|
|
|
* Get the reply, but don't pass it to command listeners. |
|
|
|
* Used for keep-alive processing only. |
|
|
|
* Used for keep-alive processing only. |
|
|
|
* @since 3.0 |
|
|
|
* |
|
|
|
* @throws IOException on error |
|
|
|
* @throws IOException on error |
|
|
|
|
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void __getReplyNoReport() throws IOException |
|
|
|
protected void __getReplyNoReport() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
__getReply(false); |
|
|
|
__getReply(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void __getReply(boolean reportReply) throws IOException |
|
|
|
private void __getReply(boolean reportReply) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
int length; |
|
|
|
int length; |
|
|
|
|
|
|
|
|
|
|
|
_newReplyString = true; |
|
|
|
_newReplyString = true; |
|
|
@ -321,26 +318,21 @@ public class FTP extends SocketClient |
|
|
|
String line = _controlInput_.readLine(); |
|
|
|
String line = _controlInput_.readLine(); |
|
|
|
|
|
|
|
|
|
|
|
if (line == null) { |
|
|
|
if (line == null) { |
|
|
|
throw new FTPConnectionClosedException( |
|
|
|
throw new FTPConnectionClosedException("Connection closed without indication."); |
|
|
|
"Connection closed without indication."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// In case we run into an anomaly we don't want fatal index exceptions
|
|
|
|
// In case we run into an anomaly we don't want fatal index exceptions
|
|
|
|
// to be thrown.
|
|
|
|
// to be thrown.
|
|
|
|
length = line.length(); |
|
|
|
length = line.length(); |
|
|
|
if (length < REPLY_CODE_LEN) { |
|
|
|
if (length < REPLY_CODE_LEN) { |
|
|
|
throw new MalformedServerReplyException( |
|
|
|
throw new MalformedServerReplyException("Truncated server reply: " + line); |
|
|
|
"Truncated server reply: " + line); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String code = null; |
|
|
|
String code = null; |
|
|
|
try |
|
|
|
try { |
|
|
|
{ |
|
|
|
|
|
|
|
code = line.substring(0, REPLY_CODE_LEN); |
|
|
|
code = line.substring(0, REPLY_CODE_LEN); |
|
|
|
_replyCode = Integer.parseInt(code); |
|
|
|
_replyCode = Integer.parseInt(code); |
|
|
|
} |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
catch (NumberFormatException e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw new MalformedServerReplyException( |
|
|
|
throw new MalformedServerReplyException( |
|
|
|
"Could not parse response code.\nServer Reply: " + line); |
|
|
|
"Could not parse response code.\nServer Reply: " + line); |
|
|
|
} |
|
|
|
} |
|
|
@ -352,13 +344,11 @@ public class FTP extends SocketClient |
|
|
|
char sep = line.charAt(REPLY_CODE_LEN); |
|
|
|
char sep = line.charAt(REPLY_CODE_LEN); |
|
|
|
// Get extra lines if message continues.
|
|
|
|
// Get extra lines if message continues.
|
|
|
|
if (sep == '-') { |
|
|
|
if (sep == '-') { |
|
|
|
do |
|
|
|
do { |
|
|
|
{ |
|
|
|
|
|
|
|
line = _controlInput_.readLine(); |
|
|
|
line = _controlInput_.readLine(); |
|
|
|
|
|
|
|
|
|
|
|
if (line == null) { |
|
|
|
if (line == null) { |
|
|
|
throw new FTPConnectionClosedException( |
|
|
|
throw new FTPConnectionClosedException("Connection closed without indication."); |
|
|
|
"Connection closed without indication."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_replyLines.add(line); |
|
|
|
_replyLines.add(line); |
|
|
@ -366,18 +356,16 @@ public class FTP extends SocketClient |
|
|
|
// The length() check handles problems that could arise from readLine()
|
|
|
|
// The length() check handles problems that could arise from readLine()
|
|
|
|
// returning too soon after encountering a naked CR or some other
|
|
|
|
// returning too soon after encountering a naked CR or some other
|
|
|
|
// anomaly.
|
|
|
|
// anomaly.
|
|
|
|
} |
|
|
|
} while (isStrictMultilineParsing() ? __strictCheck(line, code) : __lenientCheck(line)); |
|
|
|
while ( isStrictMultilineParsing() ? __strictCheck(line, code) : __lenientCheck(line)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (isStrictReplyParsing()) { |
|
|
|
} else if (isStrictReplyParsing()) { |
|
|
|
if (length == REPLY_CODE_LEN + 1) { // expecting some text
|
|
|
|
if (length == REPLY_CODE_LEN + 1) { // expecting some text
|
|
|
|
throw new MalformedServerReplyException("Truncated server reply: '" + line +"'"); |
|
|
|
throw new MalformedServerReplyException("Truncated server reply: '" + line + "'"); |
|
|
|
} else if (sep != ' ') { |
|
|
|
} else if (sep != ' ') { |
|
|
|
throw new MalformedServerReplyException("Invalid server reply: '" + line +"'"); |
|
|
|
throw new MalformedServerReplyException("Invalid server reply: '" + line + "'"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (isStrictReplyParsing()) { |
|
|
|
} else if (isStrictReplyParsing()) { |
|
|
|
throw new MalformedServerReplyException("Truncated server reply: '" + line +"'"); |
|
|
|
throw new MalformedServerReplyException("Truncated server reply: '" + line + "'"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (reportReply) { |
|
|
|
if (reportReply) { |
|
|
@ -385,7 +373,8 @@ public class FTP extends SocketClient |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (_replyCode == FTPReply.SERVICE_NOT_AVAILABLE) { |
|
|
|
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. |
|
|
|
* Initiates control connections and gets initial reply. |
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override protected void _connectAction_() throws IOException { |
|
|
|
protected void _connectAction_() throws IOException |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_connectAction_(null); |
|
|
|
_connectAction_(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Initiates control connections and gets initial reply. |
|
|
|
* Initiates control connections and gets initial reply. |
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
|
* Initializes {@link #_controlInput_} and {@link #_controlOutput_}. |
|
|
@ -410,14 +396,12 @@ public class FTP extends SocketClient |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void _connectAction_(Reader socketIsReader) throws IOException { |
|
|
|
protected void _connectAction_(Reader socketIsReader) throws IOException { |
|
|
|
super._connectAction_(); // sets up _input_ and _output_
|
|
|
|
super._connectAction_(); // sets up _input_ and _output_
|
|
|
|
if(socketIsReader == null) { |
|
|
|
if (socketIsReader == null) { |
|
|
|
_controlInput_ = |
|
|
|
_controlInput_ = new CRLFLineReader(new InputStreamReader(_input_, getControlEncoding())); |
|
|
|
new CRLFLineReader(new InputStreamReader(_input_, getControlEncoding())); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
_controlInput_ = new CRLFLineReader(socketIsReader); |
|
|
|
_controlInput_ = new CRLFLineReader(socketIsReader); |
|
|
|
} |
|
|
|
} |
|
|
|
_controlOutput_ = |
|
|
|
_controlOutput_ = new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding())); |
|
|
|
new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding())); |
|
|
|
|
|
|
|
if (connectTimeout > 0) { // NET-385
|
|
|
|
if (connectTimeout > 0) { // NET-385
|
|
|
|
int original = _socket_.getSoTimeout(); |
|
|
|
int original = _socket_.getSoTimeout(); |
|
|
|
_socket_.setSoTimeout(connectTimeout); |
|
|
|
_socket_.setSoTimeout(connectTimeout); |
|
|
@ -443,7 +427,6 @@ public class FTP extends SocketClient |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Saves the character encoding to be used by the FTP control connection. |
|
|
|
* Saves the character encoding to be used by the FTP control connection. |
|
|
|
* Some FTP servers require that commands be issued in a non-ASCII |
|
|
|
* Some FTP servers require that commands be issued in a non-ASCII |
|
|
@ -458,7 +441,6 @@ public class FTP extends SocketClient |
|
|
|
_controlEncoding = encoding; |
|
|
|
_controlEncoding = encoding; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return The character encoding used to communicate over the |
|
|
|
* @return The character encoding used to communicate over the |
|
|
|
* control connection. |
|
|
|
* control connection. |
|
|
@ -467,7 +449,6 @@ public class FTP extends SocketClient |
|
|
|
return _controlEncoding; |
|
|
|
return _controlEncoding; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Closes the control connection to the FTP server and sets to 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 |
|
|
|
* 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. |
|
|
|
* @throws IOException If an error occurs while disconnecting. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
@Override |
|
|
|
@Override public void disconnect() throws IOException { |
|
|
|
public void disconnect() throws IOException |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
super.disconnect(); |
|
|
|
super.disconnect(); |
|
|
|
_controlInput_ = null; |
|
|
|
_controlInput_ = null; |
|
|
|
_controlOutput_ = null; |
|
|
|
_controlOutput_ = null; |
|
|
@ -487,7 +466,6 @@ public class FTP extends SocketClient |
|
|
|
_replyString = null; |
|
|
|
_replyString = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Sends an FTP command to the server, waits for a reply and returns the |
|
|
|
* Sends an FTP command to the server, waits for a reply and returns the |
|
|
|
* numerical response code. After invocation, for more detailed |
|
|
|
* 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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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) { |
|
|
|
if (_controlOutput_ == null) { |
|
|
|
throw new IOException("Connection is not open"); |
|
|
|
throw new IOException("Connection is not open"); |
|
|
|
} |
|
|
|
} |
|
|
@ -529,8 +506,7 @@ public class FTP extends SocketClient |
|
|
|
|
|
|
|
|
|
|
|
__commandBuffer.append(command); |
|
|
|
__commandBuffer.append(command); |
|
|
|
|
|
|
|
|
|
|
|
if (args != null) |
|
|
|
if (args != null) { |
|
|
|
{ |
|
|
|
|
|
|
|
__commandBuffer.append(' '); |
|
|
|
__commandBuffer.append(' '); |
|
|
|
__commandBuffer.append(args); |
|
|
|
__commandBuffer.append(args); |
|
|
|
} |
|
|
|
} |
|
|
@ -538,20 +514,15 @@ public class FTP extends SocketClient |
|
|
|
return __commandBuffer.toString(); |
|
|
|
return __commandBuffer.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void __send(String message) throws IOException, |
|
|
|
private void __send(String message) |
|
|
|
FTPConnectionClosedException, SocketException { |
|
|
|
throws IOException, FTPConnectionClosedException, SocketException { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
_controlOutput_.write(message); |
|
|
|
_controlOutput_.write(message); |
|
|
|
_controlOutput_.flush(); |
|
|
|
_controlOutput_.flush(); |
|
|
|
} |
|
|
|
} catch (SocketException e) { |
|
|
|
catch (SocketException e) |
|
|
|
if (!isConnected()) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (!isConnected()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw new FTPConnectionClosedException("Connection unexpectedly closed."); |
|
|
|
throw new FTPConnectionClosedException("Connection unexpectedly closed."); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -592,9 +563,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @deprecated (3.3) Use {@link #sendCommand(FTPCmd, String)} instead |
|
|
|
* @deprecated (3.3) Use {@link #sendCommand(FTPCmd, String)} instead |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
@Deprecated |
|
|
|
@Deprecated public int sendCommand(int command, String args) throws IOException { |
|
|
|
public int sendCommand(int command, String args) throws IOException |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCommand.getCommand(command), args); |
|
|
|
return sendCommand(FTPCommand.getCommand(command), args); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -609,8 +578,8 @@ public class FTP extends SocketClient |
|
|
|
* to send. |
|
|
|
* to send. |
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
* in response to the command. |
|
|
|
* in response to the command. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -618,7 +587,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.3 |
|
|
|
* @since 3.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int sendCommand(FTPCmd command) throws IOException{ |
|
|
|
public int sendCommand(FTPCmd command) throws IOException { |
|
|
|
return sendCommand(command, null); |
|
|
|
return sendCommand(command, null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -635,8 +604,8 @@ public class FTP extends SocketClient |
|
|
|
* set to null, then the command is sent with no argument. |
|
|
|
* set to null, then the command is sent with no argument. |
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
* @return The integer value of the FTP reply code returned by the server |
|
|
|
* in response to the command. |
|
|
|
* in response to the command. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -644,7 +613,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.3 |
|
|
|
* @since 3.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int sendCommand(FTPCmd command, String args) throws IOException{ |
|
|
|
public int sendCommand(FTPCmd command, String args) throws IOException { |
|
|
|
return sendCommand(command.getCommand(), args); |
|
|
|
return sendCommand(command.getCommand(), args); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -666,12 +635,10 @@ public class FTP extends SocketClient |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int sendCommand(String command) throws IOException |
|
|
|
public int sendCommand(String command) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(command, null); |
|
|
|
return sendCommand(command, null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Sends an FTP command with no arguments to the server, waits for a |
|
|
|
* Sends an FTP command with no arguments to the server, waits for a |
|
|
|
* reply and returns the numerical response code. After invocation, for |
|
|
|
* 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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int sendCommand(int command) throws IOException |
|
|
|
public int sendCommand(int command) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(command, null); |
|
|
|
return sendCommand(command, null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Returns the integer value of the reply code of the last FTP reply. |
|
|
|
* 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 |
|
|
|
* 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. |
|
|
|
* @return The integer value of the reply code of the last FTP reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int getReplyCode() |
|
|
|
public int getReplyCode() { |
|
|
|
{ |
|
|
|
|
|
|
|
return _replyCode; |
|
|
|
return _replyCode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -727,13 +691,11 @@ public class FTP extends SocketClient |
|
|
|
* @throws IOException If an I/O error occurs while receiving the |
|
|
|
* @throws IOException If an I/O error occurs while receiving the |
|
|
|
* server reply. |
|
|
|
* server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int getReply() throws IOException |
|
|
|
public int getReply() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
__getReply(); |
|
|
|
__getReply(); |
|
|
|
return _replyCode; |
|
|
|
return _replyCode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Returns the lines of text from the last FTP server response as an array |
|
|
|
* 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 |
|
|
|
* 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. |
|
|
|
* @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()]); |
|
|
|
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. |
|
|
|
* @return The entire text from the last FTP response as a String. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public String getReplyString() |
|
|
|
public String getReplyString() { |
|
|
|
{ |
|
|
|
|
|
|
|
StringBuilder buffer; |
|
|
|
StringBuilder buffer; |
|
|
|
|
|
|
|
|
|
|
|
if (!_newReplyString) { |
|
|
|
if (!_newReplyString) { |
|
|
@ -773,7 +733,6 @@ public class FTP extends SocketClient |
|
|
|
return (_replyString = buffer.toString()); |
|
|
|
return (_replyString = buffer.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* A convenience method to send the FTP USER command to the server, |
|
|
|
* A convenience method to send the FTP USER command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* 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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
return sendCommand(FTPCmd.USER, username); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A convenience method to send the FTP PASS command to the server, |
|
|
|
* A convenience method to send the FTP PASS command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
|
|
|
|
* |
|
|
|
* @param password The plain text password of the username being logged into. |
|
|
|
* @param password The plain text password of the username being logged into. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
return sendCommand(FTPCmd.ACCT, account); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* A convenience method to send the FTP ABOR command to the server, |
|
|
|
* A convenience method to send the FTP ABOR command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* 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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int abor() throws IOException |
|
|
|
public int abor() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.ABOR); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int cdup() throws IOException |
|
|
|
public int cdup() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.CDUP); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int quit() throws IOException |
|
|
|
public int quit() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.QUIT); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int rein() throws IOException |
|
|
|
public int rein() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.REIN); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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; |
|
|
|
int num; |
|
|
|
StringBuilder info = new StringBuilder(24); |
|
|
|
StringBuilder info = new StringBuilder(24); |
|
|
|
|
|
|
|
|
|
|
@ -996,8 +945,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 2.2 |
|
|
|
* @since 2.2 |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int eprt(InetAddress host, int port) throws IOException |
|
|
|
public int eprt(InetAddress host, int port) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
int num; |
|
|
|
int num; |
|
|
|
StringBuilder info = new StringBuilder(); |
|
|
|
StringBuilder info = new StringBuilder(); |
|
|
|
String h; |
|
|
|
String h; |
|
|
@ -1040,8 +988,7 @@ public class FTP extends SocketClient |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int pasv() throws IOException |
|
|
|
public int pasv() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.PASV); |
|
|
|
return sendCommand(FTPCmd.PASV); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1061,30 +1008,29 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 2.2 |
|
|
|
* @since 2.2 |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int epsv() throws IOException |
|
|
|
public int epsv() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.EPSV); |
|
|
|
return sendCommand(FTPCmd.EPSV); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A convenience method to send the FTP TYPE command for text files |
|
|
|
* A convenience method to send the FTP TYPE command for text files |
|
|
|
* to the server, receive the reply, and return the reply code. |
|
|
|
* 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> |
|
|
|
* @param fileType The type of the file (one of the <code>FILE_TYPE</code> |
|
|
|
* constants). |
|
|
|
* constants). |
|
|
|
* @param formatOrByteSize The format of the file (one of the |
|
|
|
* @param formatOrByteSize The format of the file (one of the |
|
|
|
* <code>_FORMAT</code> constants. In the case of |
|
|
|
* <code>_FORMAT</code> constants. In the case of |
|
|
|
* <code>LOCAL_FILE_TYPE</code>, the byte size. |
|
|
|
* <code>LOCAL_FILE_TYPE</code>, the byte size. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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(); |
|
|
|
StringBuilder arg = new StringBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
arg.append(__modes.charAt(fileType)); |
|
|
|
arg.append(__modes.charAt(fileType)); |
|
|
@ -1098,7 +1044,6 @@ public class FTP extends SocketClient |
|
|
|
return sendCommand(FTPCmd.TYPE, arg.toString()); |
|
|
|
return sendCommand(FTPCmd.TYPE, arg.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A convenience method to send the FTP TYPE command to the server, |
|
|
|
* A convenience method to send the FTP TYPE command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* 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> |
|
|
|
* @param fileType The type of the file (one of the <code>FILE_TYPE</code> |
|
|
|
* constants). |
|
|
|
* constants). |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int type(int fileType) throws IOException |
|
|
|
public int type(int fileType) throws IOException { |
|
|
|
{ |
|
|
|
return sendCommand(FTPCmd.TYPE, __modes.substring(fileType, fileType + 1)); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int stru(int structure) throws IOException |
|
|
|
public int stru(int structure) throws IOException { |
|
|
|
{ |
|
|
|
return sendCommand(FTPCmd.STRU, __modes.substring(structure, structure + 1)); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int mode(int mode) throws IOException |
|
|
|
public int mode(int mode) throws IOException { |
|
|
|
{ |
|
|
|
return sendCommand(FTPCmd.MODE, __modes.substring(mode, mode + 1)); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int stou() throws IOException |
|
|
|
public int stou() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.STOU); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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)); |
|
|
|
return sendCommand(FTPCmd.ALLO, Integer.toString(bytes)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A convenience method to send the FTP FEAT command to the server, receive the reply, |
|
|
|
* A convenience method to send the FTP FEAT command to the server, receive the reply, |
|
|
|
* and return the reply code. |
|
|
|
* and return the reply code. |
|
|
|
|
|
|
|
* |
|
|
|
* @return The reply code received by the server |
|
|
|
* @return The reply code received by the server |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 2.2 |
|
|
|
* @since 2.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int feat() throws IOException |
|
|
|
public int feat() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.FEAT); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int allo(int bytes, int recordSize) throws IOException |
|
|
|
public int allo(int bytes, int recordSize) throws IOException { |
|
|
|
{ |
|
|
|
return sendCommand(FTPCmd.ALLO, Integer.toString(bytes) + " R " + Integer.toString(recordSize)); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
return sendCommand(FTPCmd.REST, marker); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param file name of file |
|
|
|
* @param file name of file |
|
|
|
* @return the status |
|
|
|
* @return the status |
|
|
|
* @throws IOException on error |
|
|
|
* @throws IOException on error |
|
|
|
* @since 2.0 |
|
|
|
* @since 2.0 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
public int mdtm(String file) throws IOException |
|
|
|
public int mdtm(String file) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.MDTM, file); |
|
|
|
return sendCommand(FTPCmd.MDTM, file); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A convenience method to send the FTP MFMT command to the server, |
|
|
|
* A convenience method to send the FTP MFMT command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* 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 pathname The pathname for which mtime is to be changed |
|
|
|
* @param timeval Timestamp in <code>YYYYMMDDhhmmss</code> format |
|
|
|
* @param timeval Timestamp in <code>YYYYMMDDhhmmss</code> format |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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>
|
|
|
|
* @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); |
|
|
|
return sendCommand(FTPCmd.MFMT, timeval + " " + pathname); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* A convenience method to send the FTP RNFR command to the server, |
|
|
|
* A convenience method to send the FTP RNFR command to the server, |
|
|
|
* receive the reply, and return the reply code. |
|
|
|
* 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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int pwd() throws IOException |
|
|
|
public int pwd() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.PWD); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int list() throws IOException |
|
|
|
public int list() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.LIST); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
return sendCommand(FTPCmd.LIST, pathname); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1547,8 +1464,8 @@ public class FTP extends SocketClient |
|
|
|
* , which will handle all low level details for you. |
|
|
|
* , which will handle all low level details for you. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -1556,8 +1473,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.0 |
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int mlsd() throws IOException |
|
|
|
public int mlsd() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.MLSD); |
|
|
|
return sendCommand(FTPCmd.MLSD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1571,8 +1487,8 @@ public class FTP extends SocketClient |
|
|
|
* @param path the path to report on |
|
|
|
* @param path the path to report on |
|
|
|
* @return The reply code received from the server, |
|
|
|
* @return The reply code received from the server, |
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -1580,8 +1496,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.0 |
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int mlsd(String path) throws IOException |
|
|
|
public int mlsd(String path) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.MLSD, path); |
|
|
|
return sendCommand(FTPCmd.MLSD, path); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1593,8 +1508,8 @@ public class FTP extends SocketClient |
|
|
|
* , which will handle all low level details for you. |
|
|
|
* , which will handle all low level details for you. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @return The reply code received from the server. |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -1602,8 +1517,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.0 |
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int mlst() throws IOException |
|
|
|
public int mlst() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.MLST); |
|
|
|
return sendCommand(FTPCmd.MLST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1617,8 +1531,8 @@ public class FTP extends SocketClient |
|
|
|
* @param path the path to report on |
|
|
|
* @param path the path to report on |
|
|
|
* @return The reply code received from the server, |
|
|
|
* @return The reply code received from the server, |
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
* may be {@code null} in which case the command is sent with no parameters |
|
|
|
* @throws FTPConnectionClosedException |
|
|
|
* @throws FTPConnectionClosedException If the FTP server prematurely closes the connection as a |
|
|
|
* If the FTP server prematurely closes the connection as a result |
|
|
|
* result |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* of the client being idle or some other reason causing the server |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* to send FTP reply code 421. This exception may be caught either |
|
|
|
* as an IOException or independently as itself. |
|
|
|
* as an IOException or independently as itself. |
|
|
@ -1626,8 +1540,7 @@ public class FTP extends SocketClient |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
* @since 3.0 |
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int mlst(String path) throws IOException |
|
|
|
public int mlst(String path) throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.MLST, path); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int nlst() throws IOException |
|
|
|
public int nlst() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.NLST); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int syst() throws IOException |
|
|
|
public int syst() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.SYST); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int stat() throws IOException |
|
|
|
public int stat() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.STAT); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int help() throws IOException |
|
|
|
public int help() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.HELP); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* 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); |
|
|
|
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 |
|
|
|
* @throws IOException If an I/O error occurs while either sending the |
|
|
|
* command or receiving the server reply. |
|
|
|
* command or receiving the server reply. |
|
|
|
***/ |
|
|
|
***/ |
|
|
|
public int noop() throws IOException |
|
|
|
public int noop() throws IOException { |
|
|
|
{ |
|
|
|
|
|
|
|
return sendCommand(FTPCmd.NOOP); |
|
|
|
return sendCommand(FTPCmd.NOOP); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return whether strict multiline parsing is enabled, as per RFC 959, section 4.2. |
|
|
|
* Return whether strict multiline parsing is enabled, as per RFC 959, section 4.2. |
|
|
|
|
|
|
|
* |
|
|
|
* @return True if strict, false if lenient |
|
|
|
* @return True if strict, false if lenient |
|
|
|
* @since 2.0 |
|
|
|
* @since 2.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1815,6 +1720,7 @@ public class FTP extends SocketClient |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set strict multiline parsing. |
|
|
|
* Set strict multiline parsing. |
|
|
|
|
|
|
|
* |
|
|
|
* @param strictMultilineParsing the setting |
|
|
|
* @param strictMultilineParsing the setting |
|
|
|
* @since 2.0 |
|
|
|
* @since 2.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1829,6 +1735,7 @@ public class FTP extends SocketClient |
|
|
|
* <br> |
|
|
|
* <br> |
|
|
|
* If false, only the 3 digit code is required (as was the case for versions up to 3.5) |
|
|
|
* If false, only the 3 digit code is required (as was the case for versions up to 3.5) |
|
|
|
* <br> |
|
|
|
* <br> |
|
|
|
|
|
|
|
* |
|
|
|
* @return True if strict (default), false if additional checks are not made |
|
|
|
* @return True if strict (default), false if additional checks are not made |
|
|
|
* @since 3.6 |
|
|
|
* @since 3.6 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1845,6 +1752,7 @@ public class FTP extends SocketClient |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* <b>This should not be required by a well-behaved FTP server</b> |
|
|
|
* <b>This should not be required by a well-behaved FTP server</b> |
|
|
|
* <br> |
|
|
|
* <br> |
|
|
|
|
|
|
|
* |
|
|
|
* @param strictReplyParsing the setting |
|
|
|
* @param strictReplyParsing the setting |
|
|
|
* @since 3.6 |
|
|
|
* @since 3.6 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1855,8 +1763,7 @@ public class FTP extends SocketClient |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provide command support to super-class
|
|
|
|
* Provide command support to super-class
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override protected ProtocolCommandSupport getCommandSupport() { |
|
|
|
protected ProtocolCommandSupport getCommandSupport() { |
|
|
|
|
|
|
|
return _commandSupport_; |
|
|
|
return _commandSupport_; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|