| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class Protocol extends Object
General protocol handling code for IMAP-like protocols.
The Protocol object is multithread safe.
Field Summary | |
---|---|
protected boolean |
debug
|
protected String |
host
|
protected PrintStream |
out
|
protected String |
prefix
|
protected Properties |
props
|
protected boolean |
quote
|
Constructor Summary | |
---|---|
Protocol(InputStream in, OutputStream out, boolean debug) Constructor for debugging. |
|
Protocol(String host, int port, boolean debug, PrintStream out, Properties props, String prefix, boolean isSSL) Constructor. |
Method Summary | |
---|---|
void |
Adds a response handler. |
Response[] |
Send a command to the server. |
protected void |
Disconnect. |
protected void |
finalize() Finalizer. |
protected ResponseInputStream |
Return the Protocol's InputStream. |
protected OutputStream |
Return the Protocol's OutputStream |
protected ByteArray |
Return a buffer to be used to read a response. |
long |
Returns the timestamp. |
void |
handleResult(Response response) Convenience routine to handle OK, NO, BAD and BYE responses. |
void |
notifyResponseHandlers(Response[] responses) Notify response handlers |
protected void |
|
Response |
|
void |
Removed the specified response handler. |
void |
simpleCommand(String cmd, Argument args) Convenience routine to handle simple IAP commands that do not have responses specific to that command. |
void |
Start TLS on the current connection. |
protected boolean |
Returns whether this Protocol supports non-synchronizing literals Default is false. |
String |
writeCommand(String command, Argument args) |
Field Detail |
---|
protected boolean debug
protected String host
protected PrintStream out
protected String prefix
protected Properties props
protected boolean quote
Constructor Detail |
---|
public Protocol(InputStream in, OutputStream out, boolean debug) throws IOException
in
out
debug
IOException
public Protocol(String host, int port, boolean debug, PrintStream out, Properties props, String prefix, boolean isSSL) throws IOException, ProtocolException
Opens a connection to the given host at given port.
host
- host to connect toport
- portnumber to connect todebug
- debug modeout
- debug output streamprops
- Properties object used by this protocolprefix
- Prefix to prepend to property keysisSSL
IOException
ProtocolException
Method Detail |
---|
public synchronized void addResponseHandler(ResponseHandler h)
h
public synchronized Response[] command(String command, Argument args)
command
- the commandargs
- the argumentsprotected synchronized void disconnect()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
protected ResponseInputStream getInputStream()
protected OutputStream getOutputStream()
protected ByteArray getResponseBuffer()
public long getTimestamp()
public void handleResult(Response response) throws ProtocolException
response
ProtocolException
public void notifyResponseHandlers(Response[] responses)
responses
protected void processGreeting(Response r) throws ProtocolException
r
ProtocolException
public Response readResponse() throws IOException, ProtocolException
IOException
ProtocolException
public synchronized void removeResponseHandler(ResponseHandler h)
h
public void simpleCommand(String cmd, Argument args) throws ProtocolException
cmd
args
ProtocolException
public synchronized void startTLS(String cmd) throws IOException, ProtocolException
cmd
is the command to issue to start TLS negotiation.
If the command succeeds, we begin TLS negotiation.
cmd
IOException
ProtocolException
protected synchronized boolean supportsNonSyncLiterals()
public String writeCommand(String command, Argument args) throws IOException, ProtocolException
command
args
IOException
ProtocolException
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |