|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.globus.ftp.vanilla.BasicClientControlChannel
org.globus.ftp.vanilla.FTPControlChannel
public class FTPControlChannel
Represents FTP Protocol Interpreter. Encapsulates control channel communication.
Field Summary | |
---|---|
static String |
CRLF
|
protected BufferedReader |
ftpIn
|
protected OutputStream |
ftpOut
|
protected boolean |
hasBeenOpened
|
protected String |
host
|
protected int |
port
|
protected InputStream |
rawFtpIn
|
protected Socket |
socket
|
Constructor Summary | |
---|---|
FTPControlChannel(InputStream in,
OutputStream out)
Using this constructor, you can initialize an instance that does not talk directly to the socket. |
|
FTPControlChannel(String host,
int port)
|
Method Summary | |
---|---|
void |
abortTransfer()
|
void |
close()
Closes the control channel |
Reply |
exchange(Command cmd)
Write the command to the control channel, block until reply arrives and return the reply. |
Reply |
execute(Command cmd)
Write the command to the control channel, block until reply arrives and check if the command completed successfully (reply code 200). |
protected BufferedReader |
getBufferedReader()
|
String |
getHost()
|
Reply |
getLastReply()
Returns the last reply received from the server. |
protected OutputStream |
getOutputStream()
|
int |
getPort()
|
protected boolean |
hasBeenOpened()
|
protected boolean |
haveStreams()
|
boolean |
isIPv6()
|
void |
open()
opens the connection and returns after it is ready for communication. |
Reply |
read()
Block until a reply is available in the control channel. |
protected void |
readInitialReplies()
|
protected void |
setInputStream(InputStream in)
|
protected void |
setOutputStream(OutputStream out)
|
void |
waitFor(Flag aborted,
int ioDelay,
int maxWait)
Block until one of the conditions are true: a reply is available in the control channel, timeout (maxWait) expired aborted flag changes to true. |
void |
write(Command cmd)
Sends the command over the control channel. |
protected void |
writeln(String msg)
|
protected void |
writeStr(String msg)
|
Methods inherited from class org.globus.ftp.vanilla.BasicClientControlChannel |
---|
waitFor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CRLF
protected Socket socket
protected BufferedReader ftpIn
protected InputStream rawFtpIn
protected OutputStream ftpOut
protected String host
protected int port
protected boolean hasBeenOpened
Constructor Detail |
---|
public FTPControlChannel(String host, int port)
public FTPControlChannel(InputStream in, OutputStream out)
Method Detail |
---|
public String getHost()
public int getPort()
public boolean isIPv6()
protected BufferedReader getBufferedReader()
protected OutputStream getOutputStream()
protected void setInputStream(InputStream in)
protected void setOutputStream(OutputStream out)
public void open() throws IOException, ServerException
120 220 220 421
IOException
- on I/O error
ServerException
- on negative or faulty server replyprotected void readInitialReplies() throws IOException, ServerException
IOException
ServerException
public Reply getLastReply()
public void close() throws IOException
IOException
public void waitFor(Flag aborted, int ioDelay, int maxWait) throws ServerException, IOException, InterruptedException
waitFor
in class BasicClientControlChannel
maxWait
- timeout in milisecondsioDelay
- frequency of polling the control channel
and checking the conditionsaborted
- flag indicating wait aborted.
ServerException
IOException
InterruptedException
public Reply read() throws ServerException, IOException, FTPReplyParseException
read
in class BasicClientControlChannel
IOException
- on I/O error
FTPReplyParseException
- on malformatted server reply
ServerException
public void abortTransfer()
abortTransfer
in class BasicClientControlChannel
public void write(Command cmd) throws IOException, IllegalArgumentException
cmd
- FTP command
IOException
- on I/O error
IllegalArgumentException
public Reply exchange(Command cmd) throws ServerException, IOException, FTPReplyParseException
cmd
- FTP command
IOException
- on I/O error
FTPReplyParseException
- on bad reply format
ServerException
public Reply execute(Command cmd) throws ServerException, IOException, FTPReplyParseException, UnexpectedReplyCodeException
cmd
- FTP command
IOException
- on I/O error
FTPReplyParseException
- on bad reply format
UnexpectedReplyCodeException
- if reply is not a positive
completion reply (code 200)
ServerException
protected void writeln(String msg) throws IOException
IOException
protected void writeStr(String msg) throws IOException
IOException
protected boolean hasBeenOpened()
protected boolean haveStreams()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |