ePOST API

rice.email.proxy.imap
Class ImapConnection

java.lang.Object
  extended by rice.email.proxy.imap.ImapConnection

public class ImapConnection
extends java.lang.Object

A Socket wrapper for use by ImapCommands.


Field Summary
 java.io.BufferedReader _in
           
 java.io.PrintWriter _out
           
protected  Logger logger
           
 
Constructor Summary
ImapConnection(Quittable handler, java.net.Socket sock, Environment env)
           
 
Method Summary
 java.lang.String getClientAddress()
          Returns identifying information (IP and/or hostname) of the client.
 Environment getEnvironment()
          returns the environment
 java.io.BufferedReader getReader()
          Allows reading directly from the input stream.
 void print(java.io.Reader in)
          Sends the entire contents of a Reader to the client, and closes it.
 void print(java.lang.String string)
          Sometimes you don't need a newline.
 void println(java.lang.String line)
          Writes a string and newline to the output stream.
 void quit()
          Specifies that no more commands should be processed after the current on finishes.
 java.lang.String readLine()
          Reads a line sent by the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_out

public java.io.PrintWriter _out

_in

public java.io.BufferedReader _in

logger

protected Logger logger
Constructor Detail

ImapConnection

public ImapConnection(Quittable handler,
                      java.net.Socket sock,
                      Environment env)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

println

public void println(java.lang.String line)
Writes a string and newline to the output stream. Currently also writes to System.out for logging purposes.

Command implementations, in general, should not this method. They should instead use one of the methods in AbstractImapCommand.


print

public void print(java.lang.String string)
Sometimes you don't need a newline.

Most command implementations should use one of the methods in AbstractImapCommand. Some commands, like FETCH, require complex replies that are best implemented by writing to an ImapConnection in small chunks.


print

public void print(java.io.Reader in)
           throws java.io.IOException
Sends the entire contents of a Reader to the client, and closes it.

This method is useful for commands like FETCH, which need to send the contents of StoredMessages.

The data written will not be logged

Throws:
java.io.IOException

getReader

public java.io.BufferedReader getReader()
Allows reading directly from the input stream.

There is only one command at the moment which has a good excuse to use this method: APPEND. If at some point it seems like a good idea to allow IMAP literals in any part of any command, then excuses might be given to other classes.

The data written will not be logged


readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads a line sent by the client.

The only classes with an excuse to use this method at the moment are AppendCommand and ParserImapHandler.

Throws:
DisconnectedException - If the socket has been disconnected
java.io.IOException

quit

public void quit()
Specifies that no more commands should be processed after the current on finishes.

See Also:
Quittable.quit()

getClientAddress

public java.lang.String getClientAddress()
Returns identifying information (IP and/or hostname) of the client.

For debugging/logging only, at present. The output format of this method may change.


getEnvironment

public Environment getEnvironment()
returns the environment


ePOST API

Copyright © 2001-2005 - Rice Pastry.