|
||||||||||
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 java.lang.String |
CRLF
|
protected java.io.BufferedReader |
ftpIn
|
protected java.io.OutputStream |
ftpOut
|
protected boolean |
hasBeenOpened
|
protected java.lang.String |
host
|
protected int |
port
|
protected java.io.InputStream |
rawFtpIn
|
protected java.net.Socket |
socket
|
Constructor Summary | |
---|---|
FTPControlChannel(java.io.InputStream in,
java.io.OutputStream out)
Using this constructor, you can initialize an instance that does not talk directly to the socket. |
|
FTPControlChannel(java.lang.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 java.io.BufferedReader |
getBufferedReader()
|
java.lang.String |
getHost()
|
Reply |
getLastReply()
Returns the last reply received from the server. |
protected java.io.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(java.io.InputStream in)
|
protected void |
setOutputStream(java.io.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(java.lang.String msg)
|
protected void |
writeStr(java.lang.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 java.lang.String CRLF
protected java.net.Socket socket
protected java.io.BufferedReader ftpIn
protected java.io.InputStream rawFtpIn
protected java.io.OutputStream ftpOut
protected java.lang.String host
protected int port
protected boolean hasBeenOpened
Constructor Detail |
---|
public FTPControlChannel(java.lang.String host, int port)
public FTPControlChannel(java.io.InputStream in, java.io.OutputStream out)
Method Detail |
---|
public java.lang.String getHost()
public int getPort()
public boolean isIPv6()
protected java.io.BufferedReader getBufferedReader()
protected java.io.OutputStream getOutputStream()
protected void setInputStream(java.io.InputStream in)
protected void setOutputStream(java.io.OutputStream out)
public void open() throws java.io.IOException, ServerException
120 220 220 421
java.io.IOException
- on I/O error
ServerException
- on negative or faulty server replyprotected void readInitialReplies() throws java.io.IOException, ServerException
java.io.IOException
ServerException
public Reply getLastReply()
public void close() throws java.io.IOException
java.io.IOException
public void waitFor(Flag aborted, int ioDelay, int maxWait) throws ServerException, java.io.IOException, java.lang.InterruptedException
waitFor
in class BasicClientControlChannel
maxWait
- timeout in milisecondsioDelay
- frequency of polling the control channel
and checking the conditionsaborted
- flag indicating wait aborted.
ServerException
java.io.IOException
java.lang.InterruptedException
public Reply read() throws ServerException, java.io.IOException, FTPReplyParseException, java.io.EOFException
read
in class BasicClientControlChannel
java.io.IOException
- on I/O error
FTPReplyParseException
- on malformatted server reply
ServerException
java.io.EOFException
public void abortTransfer()
abortTransfer
in class BasicClientControlChannel
public void write(Command cmd) throws java.io.IOException, java.lang.IllegalArgumentException
cmd
- FTP command
java.io.IOException
- on I/O error
java.lang.IllegalArgumentException
public Reply exchange(Command cmd) throws ServerException, java.io.IOException, FTPReplyParseException
cmd
- FTP command
java.io.IOException
- on I/O error
FTPReplyParseException
- on bad reply format
ServerException
public Reply execute(Command cmd) throws ServerException, java.io.IOException, FTPReplyParseException, UnexpectedReplyCodeException
cmd
- FTP command
java.io.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(java.lang.String msg) throws java.io.IOException
java.io.IOException
protected void writeStr(java.lang.String msg) throws java.io.IOException
java.io.IOException
protected boolean hasBeenOpened()
protected boolean haveStreams()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |