Constructor and Description |
---|
FtpResponse()
Creates an empty FTP response.
|
FtpResponse(int code,
String[] response)
Creates an FTP response with given status code and response string.
|
Modifier and Type | Method and Description |
---|---|
int |
getCode()
Gets the numeric response code.
|
String[] |
getResponse()
Gets the response string array.
|
boolean |
isCodeValid()
Does this response have a valid code?
|
boolean |
isIntermediate()
Is this response an intermediate message?
|
boolean |
isSuccess()
Is this response a successful message?
|
static FtpResponse |
readResponse(BufferedReader in)
Reads a server response.
|
boolean |
responseContains(String contain)
Search for a text string in each line of the response result.
|
static void |
sendCommand(Socket socket,
String command)
Helper method to send commands to the remote server.
|
void |
setCode(int code)
Sets the numeric response code.
|
void |
setResponse(String[] response)
Sets the response string array.
|
String |
toString()
Converts FTP response to string.
|
public FtpResponse()
public FtpResponse(int code, String[] response)
code
- numeric status coderesponse
- response detail message (one line per array element)public int getCode()
public void setCode(int code)
code
- numeric status codepublic String[] getResponse()
public void setResponse(String[] response)
response
- response detail message (one line per array element)public boolean responseContains(String contain)
contain
- text to search for (using String.contains(contain))public String toString()
public boolean isCodeValid()
public boolean isSuccess()
public boolean isIntermediate()
public static void sendCommand(Socket socket, String command) throws IOException
socket
- connection to the servercommand
- command to send, without trailing EOL (CRLF, \r\n).IOException
- if we can't write() to the OutputStream for the Socketpublic static FtpResponse readResponse(BufferedReader in) throws IOException
in
- input readerIOException
- if any.Copyright © 2017. All rights reserved.