|
|||||||||
| Home >> All >> org >> [ finj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.finj
Class FTPResponse

java.lang.Objectorg.finj.FTPResponse
- public class FTPResponse
- extends java.lang.Object
This class contains constants and methods that simplify handling and internationalization of FTP server replies. Codes according to RFC959-4.2 http://www.rfc.net/rfc959.html (October 1995). Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Version:
- $Id: FTPResponse.java,v 1.2 2003/10/22 08:14:57 jiglesia Exp $
| Field Summary | |
static int |
BAD_COMMAND_SEQUENCE_CODE
Bad sequence of commands. |
static int |
CAN_T_OPEN_DATA_CONNECTION_CODE
Can't open data connection. |
private int |
code
|
static int |
COMMAND_NOT_IMPLEMENTED_CODE
Command not implemented. |
static int |
COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE
Command not implemented for that parameter. |
static int |
CONTROL_CONNECTION_CLOSED_CODE
Service closing control connection. |
static int |
CONTROL_CONNECTION_OPENED_CODE
Service ready for new user. |
static int |
DATA_CONNECTION_ABORTED_CODE
Connection closed; transfer aborted. |
static int |
DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE
File status okay; about to open data connection. |
static int |
DATA_CONNECTION_ALREADY_OPENED_CODE
Data Connection already open; transfer starting. |
static int |
DATA_CONNECTION_CLOSED_CODE
Closing data connection. |
static int |
DATA_CONNECTION_OPENED_CODE
Data connection open; no transfer in progress. |
private static java.lang.String |
DEFAULT_MESSAGE_NAME
|
static int |
DIRECTORY_STATUS_CODE
Directory status |
static int |
ENTERING_PASSIVE_MODE_CODE
Entering Passive Mode (h1,h2,h3,h4,p1,p2). |
static int |
EXCEEDED_STORAGE_ALLOCATION_CODE
Requested file action aborted. |
static int |
FILE_STATUS_CODE
File status. |
static int |
FINE_NAME_NOT_ALLOWED_CODE
Requested action not taken. |
static int |
HELP_MESSAGE_CODE
Help message. |
private static java.lang.String |
MESSAGE_BUNDLE_NAME
|
private static java.lang.String |
MESSAGE_NAME_PREFIX
|
private java.lang.String[] |
multi
|
static int |
NEED_ACCOUNT_FOR_LOGIN_CODE
Need account for login. |
static int |
NEED_ACCOUNT_FOR_STORING_FILES_CODE
Need account for storing files. |
private static int |
NOT_A_REAL_RESPONSE_CODE
No response will ever (as RFC959 is concerned...) match this code ! Used for comparisions purposes. |
static int |
NOT_LOGGED_IN_CODE
Not logged in. |
static int |
PAGE_TYPE_UNKNOWN_CODE
Requested action aborted: page type unknown. |
static int |
PATHNAME_CREATED_CODE
"PATHNAME" created. |
static int |
PERMANENT_NEGATIVE_COMPLETION_RESPONSE_CODE
Syntax error, command unrecognized. |
static int |
PERMANENTLY_UNAVAILABLE_FILE_CODE
Requested action not taken. |
static int |
POSITIVE_COMPLETION_RESPONSE_CODE
Command okay. |
static int |
REQUESTED_FILE_ACTION_OK_CODE
Requested file action okay, completed. |
static int |
REQUESTED_FILE_ACTION_PENDING_CODE
Requested file action pending further information. |
private java.util.ResourceBundle |
resources
|
static int |
RESTART_MARKER_RESPONSE_CODE
Restart marker response. |
static int |
SERVICE_NOT_AVAILABLE_CODE
Service not available, closing control connection. |
static int |
SUPERFLOUS_COMMAND_CODE
Command not implemented, superfluous at this site. |
static int |
SYNTAX_ERROR_IN_ARGUMENTS_CODE
Syntax error n parameters or arguments. |
static int |
SYSTEM_STATUS_OR_HELP_RESPONSE_CODE
System status, or system help response. |
static int |
SYSTEM_TYPE_NAME_CODE
NAME system type. |
private java.lang.String |
text
|
static int |
TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE
Requested action not taken. |
static int |
TRANSIENT_LOCAL_PROCESSING_ERROR_CODE
Requested action aborted: local error in processing. |
static int |
TRANSIENT_UNAVAILABLE_FILE_CODE
Requested file action not taken. |
static int |
USER_LOGGED_IN_CODE
User logged in, proceed. |
static int |
USERNAME_OK_NEED_PASSWORD_CODE
User name okay, need password. |
static int |
WILL_BE_READY_IN_MINUTES_CODE
Service ready in nnn minutes. |
| Constructor Summary | |
private |
FTPResponse()
Defeat parameterless constructor. |
|
FTPResponse(int code,
java.lang.String text,
java.lang.String[] multi,
java.util.Locale locale)
Initializes the current instance with the info provided. |
|
FTPResponse(java.lang.String response)
Constructs a new instance of this class that will use FTPConstants.DEFAULT_LOCALE as
default locale. |
|
FTPResponse(java.lang.String response,
java.util.Locale locale)
Constructs a new instance of this class that will use locale as
message language. |
|
FTPResponse(java.lang.String response,
java.lang.String[] multiline)
Constructs a new instance of this class that will use FTPConstants.DEFAULT_LOCALE as
default locale, and will store a multiline answer. |
|
FTPResponse(java.lang.String response,
java.lang.String[] multiline,
java.util.Locale locale)
Constructs a new instance of this class that will use locale as
message language. |
| Method Summary | |
static boolean |
closesMultilineResponse(java.lang.String response,
int code)
Tests a line of a response to know if it closes a multiline answer. |
int |
getCode()
Returns the FTP code of this response. |
java.lang.String |
getMessage()
Returns a localized version of the message corresponding to the original one's code. |
protected java.lang.String |
getMessageFromCode(int code)
Returns the message that corresponds to the code given as parameter. |
java.lang.String[] |
getMultilineText()
Returns the multiline answer received with this response. |
java.lang.String |
getOriginalMessage()
Returns the original message received from the FTP server and passed at construction time. |
boolean |
isMultiline()
Returns true if this response anounces a multi line response, e.g., STAT command. |
static boolean |
opensMultilineResponse(java.lang.String response)
Tests the first line of a response to know if it opens a multiline answer. |
static int |
parseCode(java.lang.String response)
Returns the code contained in the response passed as parameter. |
static java.lang.String |
parseOriginalMessage(java.lang.String response)
Returns the message contained in the response passed as parameter. |
java.lang.String[] |
parseServerPassivePort()
Returns the host passive port parsed from the original text of response. |
java.lang.String |
parseWorkingDirectory()
This command causes the name of the current working directory to be returned. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
NOT_A_REAL_RESPONSE_CODE
private static final int NOT_A_REAL_RESPONSE_CODE
- No response will ever (as RFC959 is concerned...) match this code !
Used for comparisions purposes.
- Since:
- v1.0.2
- See Also:
- Constant Field Values
RESTART_MARKER_RESPONSE_CODE
public static final int RESTART_MARKER_RESPONSE_CODE
- Restart marker response.
In this case, the text is exact and not
left to the particular implementation; it must read :
MARK yyyy = mmmmWhereyyyyis User-process data stream marker, andmmmmserver's equivalent marker (note the spaces between markers and '=`).- Since:
- v1.0
- See Also:
- "RFC959-4:2:'110'", Constant Field Values
WILL_BE_READY_IN_MINUTES_CODE
public static final int WILL_BE_READY_IN_MINUTES_CODE
- Service ready in
nnnminutes.- Since:
- v1.0
- See Also:
- "RFC959-4:2:'120'", Constant Field Values
DATA_CONNECTION_ALREADY_OPENED_CODE
public static final int DATA_CONNECTION_ALREADY_OPENED_CODE
- Data Connection already open; transfer starting.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'125'", Constant Field Values
DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE
public static final int DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE
- File status okay; about to open data connection.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'150'", Constant Field Values
POSITIVE_COMPLETION_RESPONSE_CODE
public static final int POSITIVE_COMPLETION_RESPONSE_CODE
- Command okay.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'200'", Constant Field Values
SUPERFLOUS_COMMAND_CODE
public static final int SUPERFLOUS_COMMAND_CODE
- Command not implemented, superfluous at this site.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'202'", Constant Field Values
SYSTEM_STATUS_OR_HELP_RESPONSE_CODE
public static final int SYSTEM_STATUS_OR_HELP_RESPONSE_CODE
- System status, or system help response.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'211'", Constant Field Values
DIRECTORY_STATUS_CODE
public static final int DIRECTORY_STATUS_CODE
- Directory status
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'212'", Constant Field Values
FILE_STATUS_CODE
public static final int FILE_STATUS_CODE
- File status.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'213'", Constant Field Values
HELP_MESSAGE_CODE
public static final int HELP_MESSAGE_CODE
- Help message.
On how to use the server or the meaning of a particular
non-standard command. This response is useful only to the
human user.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'214'", Constant Field Values
SYSTEM_TYPE_NAME_CODE
public static final int SYSTEM_TYPE_NAME_CODE
NAMEsystem type. WhereNAMEis an official system name from the list in the Assigned Numbers document.- Since:
- v1.0
- See Also:
- "RFC959-4:2:'215'", "RFC1700", Constant Field Values
CONTROL_CONNECTION_OPENED_CODE
public static final int CONTROL_CONNECTION_OPENED_CODE
- Service ready for new user.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'220'", Constant Field Values
CONTROL_CONNECTION_CLOSED_CODE
public static final int CONTROL_CONNECTION_CLOSED_CODE
- Service closing control connection.
Logged out if appropriate.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'221'", Constant Field Values
DATA_CONNECTION_OPENED_CODE
public static final int DATA_CONNECTION_OPENED_CODE
- Data connection open; no transfer in progress.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'225'", Constant Field Values
DATA_CONNECTION_CLOSED_CODE
public static final int DATA_CONNECTION_CLOSED_CODE
- Closing data connection.
Requested file action successful (e.g., file transfer or
file abort).
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'226'", Constant Field Values
ENTERING_PASSIVE_MODE_CODE
public static final int ENTERING_PASSIVE_MODE_CODE
- Entering Passive Mode (h1,h2,h3,h4,p1,p2).
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'227'", Constant Field Values
USER_LOGGED_IN_CODE
public static final int USER_LOGGED_IN_CODE
- User logged in, proceed.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'230'", Constant Field Values
REQUESTED_FILE_ACTION_OK_CODE
public static final int REQUESTED_FILE_ACTION_OK_CODE
- Requested file action okay, completed.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'250'", Constant Field Values
PATHNAME_CREATED_CODE
public static final int PATHNAME_CREATED_CODE
- "PATHNAME" created.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'257'", Constant Field Values
USERNAME_OK_NEED_PASSWORD_CODE
public static final int USERNAME_OK_NEED_PASSWORD_CODE
- User name okay, need password.
- Since:
- v1.0
- See Also:
- "RFC959-4:2;'331'", Constant Field Values
NEED_ACCOUNT_FOR_LOGIN_CODE
public static final int NEED_ACCOUNT_FOR_LOGIN_CODE
- Need account for login.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'332'", Constant Field Values
REQUESTED_FILE_ACTION_PENDING_CODE
public static final int REQUESTED_FILE_ACTION_PENDING_CODE
- Requested file action pending further information.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'350'", Constant Field Values
SERVICE_NOT_AVAILABLE_CODE
public static final int SERVICE_NOT_AVAILABLE_CODE
- Service not available, closing control connection.
This may be a response to any command if the service
knows it must shut down.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'421'", Constant Field Values
CAN_T_OPEN_DATA_CONNECTION_CODE
public static final int CAN_T_OPEN_DATA_CONNECTION_CODE
- Can't open data connection.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'425'", Constant Field Values
DATA_CONNECTION_ABORTED_CODE
public static final int DATA_CONNECTION_ABORTED_CODE
- Connection closed; transfer aborted.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'426'", Constant Field Values
TRANSIENT_UNAVAILABLE_FILE_CODE
public static final int TRANSIENT_UNAVAILABLE_FILE_CODE
- Requested file action not taken.
File unavailable (e.g., file busy).
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'450'", Constant Field Values
TRANSIENT_LOCAL_PROCESSING_ERROR_CODE
public static final int TRANSIENT_LOCAL_PROCESSING_ERROR_CODE
- Requested action aborted: local error in processing.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'451'", Constant Field Values
TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE
public static final int TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE
- Requested action not taken.
Insufficient storage space in system.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'452'", Constant Field Values
PERMANENT_NEGATIVE_COMPLETION_RESPONSE_CODE
public static final int PERMANENT_NEGATIVE_COMPLETION_RESPONSE_CODE
- Syntax error, command unrecognized.
This may include errors such as command line too long.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'500'", Constant Field Values
SYNTAX_ERROR_IN_ARGUMENTS_CODE
public static final int SYNTAX_ERROR_IN_ARGUMENTS_CODE
- Syntax error n parameters or arguments.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'501'", Constant Field Values
COMMAND_NOT_IMPLEMENTED_CODE
public static final int COMMAND_NOT_IMPLEMENTED_CODE
- Command not implemented.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'502'", Constant Field Values
BAD_COMMAND_SEQUENCE_CODE
public static final int BAD_COMMAND_SEQUENCE_CODE
- Bad sequence of commands.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'503'", Constant Field Values
COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE
public static final int COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE
- Command not implemented for that parameter.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'504'", Constant Field Values
NOT_LOGGED_IN_CODE
public static final int NOT_LOGGED_IN_CODE
- Not logged in.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'530'", Constant Field Values
NEED_ACCOUNT_FOR_STORING_FILES_CODE
public static final int NEED_ACCOUNT_FOR_STORING_FILES_CODE
- Need account for storing files.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'532'", Constant Field Values
PERMANENTLY_UNAVAILABLE_FILE_CODE
public static final int PERMANENTLY_UNAVAILABLE_FILE_CODE
- Requested action not taken.
File unavailable (e.g., file not found, no access).
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'550'", Constant Field Values
PAGE_TYPE_UNKNOWN_CODE
public static final int PAGE_TYPE_UNKNOWN_CODE
- Requested action aborted: page type unknown.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'551'", Constant Field Values
EXCEEDED_STORAGE_ALLOCATION_CODE
public static final int EXCEEDED_STORAGE_ALLOCATION_CODE
- Requested file action aborted.
Exceed storage allocation (for current directory or dataset).
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'552'", Constant Field Values
FINE_NAME_NOT_ALLOWED_CODE
public static final int FINE_NAME_NOT_ALLOWED_CODE
- Requested action not taken.
File name not allowed.
- Since:
- v1.0
- See Also:
- "RFC959-4:2:'553'", Constant Field Values
MESSAGE_BUNDLE_NAME
private static final java.lang.String MESSAGE_BUNDLE_NAME
- See Also:
- Constant Field Values
MESSAGE_NAME_PREFIX
private static final java.lang.String MESSAGE_NAME_PREFIX
- See Also:
- Constant Field Values
DEFAULT_MESSAGE_NAME
private static final java.lang.String DEFAULT_MESSAGE_NAME
- See Also:
- Constant Field Values
resources
private java.util.ResourceBundle resources
code
private int code
text
private java.lang.String text
multi
private java.lang.String[] multi
| Constructor Detail |
FTPResponse
private FTPResponse()
- Defeat parameterless constructor.
- Since:
- v1.0
FTPResponse
public FTPResponse(java.lang.String response)
- Constructs a new instance of this class that will
use
FTPConstants.DEFAULT_LOCALEas default locale. - Since:
- v1.0
FTPResponse
public FTPResponse(java.lang.String response, java.lang.String[] multiline)
- Constructs a new instance of this class that will
use
FTPConstants.DEFAULT_LOCALEas default locale, and will store a multiline answer. - Since:
- v1.0
FTPResponse
public FTPResponse(java.lang.String response, java.util.Locale locale) throws java.lang.IllegalArgumentException
- Constructs a new instance of this class
that will use
localeas message language. If not available, messages for default language (Locale.US) will be used. - Since:
- v1.0
FTPResponse
public FTPResponse(java.lang.String response, java.lang.String[] multiline, java.util.Locale locale) throws java.lang.IllegalArgumentException
- Constructs a new instance of this class
that will use
localeas message language. If not available, messages for default language (Locale.US) will be used. - Since:
- v1.0
FTPResponse
public FTPResponse(int code,
java.lang.String text,
java.lang.String[] multi,
java.util.Locale locale)
- Initializes the current instance with the info provided.
- Since:
- v1.0
| Method Detail |
getCode
public int getCode()
- Returns the FTP code of this response.
- Since:
- v1.0
getMessage
public java.lang.String getMessage()
- Returns a localized version of the message corresponding
to the original one's code. This will only work if a
localized version of the messages are provided.
- Since:
- v1.0
getOriginalMessage
public java.lang.String getOriginalMessage()
- Returns the original message received from the FTP server
and passed at construction time.
- Since:
- v1.0
isMultiline
public boolean isMultiline()
- Returns true if this response anounces a multi line response,
e.g.,
STATcommand.- Since:
- v1.0
getMultilineText
public java.lang.String[] getMultilineText()
- Returns the multiline answer received with this response.
- Since:
- v1.0
getMessageFromCode
protected java.lang.String getMessageFromCode(int code)
- Returns the message that corresponds to the
codegiven as parameter.- Since:
- v1.0
opensMultilineResponse
public static boolean opensMultilineResponse(java.lang.String response)
- Tests the first line of a response to know if it opens
a multiline answer.
- Since:
- v1.0.2
closesMultilineResponse
public static boolean closesMultilineResponse(java.lang.String response, int code)
- Tests a line of a response to know if it closes
a multiline answer.
- Since:
- v1.0.2
parseCode
public static int parseCode(java.lang.String response) throws java.lang.IllegalArgumentException
- Returns the code contained in the
responsepassed as parameter. This code are in fact the 3 first characters of theresponse.- Since:
- v1.0
parseOriginalMessage
public static java.lang.String parseOriginalMessage(java.lang.String response) throws java.lang.IllegalArgumentException
- Returns the message contained in the
responsepassed as parameter.- Since:
- v1.0
parseServerPassivePort
public java.lang.String[] parseServerPassivePort() throws FTPException
- Returns the host passive port parsed from the original text of response.
The author of this method is Syed Meerkasim.
- Since:
- v1.0
parseWorkingDirectory
public java.lang.String parseWorkingDirectory()
- This command causes the name of the current working directory to be
returned.
- Since:
- v1.0
|
|||||||||
| Home >> All >> org >> [ finj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.finj.FTPResponse