Secure iNet Factory

com.jscape.inet.ftps
Class Response

java.lang.Object
  extended by com.jscape.inet.ftps.Response

public final class Response
extends java.lang.Object

The FTP server response abstraction.

Version:
1.0
Author:
Denis Bondarenko

Field Summary
static int NEGATIVE_PERMANENT
          Permanent Negative Completion reply starting code
static int NEGATIVE_TRANSIENT
          Transient Negative Completion reply starting code
static int POSITIVE_COMPLETION
          Positive Completion reply starting code
static int POSITIVE_INTERMEDIATE
          Positive Intermediate reply starting code
static int POSITIVE_PRELIMINARY
          Positive Preliminary reply starting code
 
Constructor Summary
Response(int code, java.lang.String text)
          Creates a new response instance.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks two responses equality.
 int getCode()
          Returns the response code.
 java.lang.String getMessage()
          Returns the response message.
 int hashCode()
          Returns response hash code.
 boolean isNegative()
          Checks if the current response is negative in the meaning of the possible FTP response codes.
 boolean isPreliminary()
          Checks if the current response is preliminary in the meaning of the possible FTP response codes.
static Response readFrom(java.io.BufferedReader in)
          Reads the FTP response from the input stream.
 java.lang.String toString()
          Provides the human-readable response representation.
 void writeTo(java.io.OutputStream out)
          Writes the current response to the specified output stream.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

POSITIVE_PRELIMINARY

public static final int POSITIVE_PRELIMINARY
Positive Preliminary reply starting code

See Also:
Constant Field Values

POSITIVE_COMPLETION

public static final int POSITIVE_COMPLETION
Positive Completion reply starting code

See Also:
Constant Field Values

POSITIVE_INTERMEDIATE

public static final int POSITIVE_INTERMEDIATE
Positive Intermediate reply starting code

See Also:
Constant Field Values

NEGATIVE_TRANSIENT

public static final int NEGATIVE_TRANSIENT
Transient Negative Completion reply starting code

See Also:
Constant Field Values

NEGATIVE_PERMANENT

public static final int NEGATIVE_PERMANENT
Permanent Negative Completion reply starting code

See Also:
Constant Field Values
Constructor Detail

Response

public Response(int code,
                java.lang.String text)
Creates a new response instance.

Parameters:
code - the response code
text - the response message
Method Detail

readFrom

public static Response readFrom(java.io.BufferedReader in)
                         throws java.io.IOException,
                                FtpException
Reads the FTP response from the input stream.

Parameters:
in - the target input stream
Returns:
the readed response
Throws:
FtpException - if an I/O or protocol error occurs
java.io.IOException - if an I/O or protocol error occurs

getCode

public int getCode()
Returns the response code.

Returns:
the response code

getMessage

public java.lang.String getMessage()
Returns the response message.

Returns:
the response message

toString

public java.lang.String toString()
Provides the human-readable response representation.

Overrides:
toString in class java.lang.Object
Returns:
the human-readable response representation

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes the current response to the specified output stream.

Parameters:
out - target output stream
Throws:
java.io.IOException - if an I/O error occurs

equals

public boolean equals(java.lang.Object o)
Checks two responses equality. The FTP responces are equal if they have the same code.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to check
Returns:
true if both responses are equal; false otherwise

hashCode

public int hashCode()
Returns response hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
response hash code

isNegative

public boolean isNegative()
Checks if the current response is negative in the meaning of the possible FTP response codes. This method may be used for general error check.

Returns:
true if the current response is negative; false otherwise

isPreliminary

public boolean isPreliminary()
Checks if the current response is preliminary in the meaning of the possible FTP response codes.

Returns:
true if the current response is preliminary; false otherwise

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved