|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.oroinc.net.SocketClient | +--com.oroinc.net.pop3.POP3 | +--com.oroinc.net.pop3.POP3Client
The POP3Client class implements the client side of the Internet POP3 Protocol defined in RFC 1939. All commands are supported, including the APOP command which requires MD5 encryption. See RFC 1939 for more details on the POP3 protocol.
Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a MalformedServerReplyException , which is a subclass of IOException. A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.
POP3MessageInfo
,
DotTerminatedMessageReader
,
MalformedServerReplyException
Fields inherited from class com.oroinc.net.pop3.POP3 |
_commandSupport_, AUTHORIZATION_STATE, DEFAULT_PORT, DISCONNECTED_STATE, TRANSACTION_STATE, UPDATE_STATE |
Fields inherited from class com.oroinc.net.SocketClient |
_defaultPort_, _input_, _isConnected_, _output_, _socket_, _socketFactory_, _timeout_, NETASCII_EOL |
Constructor Summary | |
POP3Client()
|
Method Summary | |
boolean |
deleteMessage(int messageId)
Delete a message from the POP3 server. |
POP3MessageInfo |
listMessage(int messageId)
List an individual message. |
POP3MessageInfo[] |
listMessages()
List all messages. |
POP3MessageInfo |
listUniqueIdentifier(int messageId)
List the unique identifier for a message. |
POP3MessageInfo[] |
listUniqueIdentifiers()
List the unique identifiers for all messages. |
boolean |
login(java.lang.String username,
java.lang.String password)
Login to the POP3 server with the given username and password. |
boolean |
login(java.lang.String username,
java.lang.String timestamp,
java.lang.String secret)
Login to the POP3 server with the given username and authentication information. |
boolean |
logout()
Logout of the POP3 server. |
boolean |
noop()
Send a NOOP command to the POP3 server. |
boolean |
reset()
Reset the POP3 session. |
java.io.Reader |
retrieveMessage(int messageId)
Retrieve a message from the POP3 server. |
java.io.Reader |
retrieveMessageTop(int messageId,
int numLines)
Retrieve only the specified top number of lines of a message from the POP3 server. |
POP3MessageInfo |
status()
Get the mailbox status. |
Methods inherited from class com.oroinc.net.pop3.POP3 |
_connectAction_, addProtocolCommandListener, disconnect, getAdditionalReply, getReplyString, getReplyStrings, getState, removeProtocolCommandistener, sendCommand, sendCommand, sendCommand, sendCommand, setState |
Methods inherited from class com.oroinc.net.SocketClient |
connect, connect, connect, connect, connect, connect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public POP3Client()
Method Detail |
public boolean login(java.lang.String username, java.lang.String password) throws java.io.IOException
username
- The account name being logged in to.password
- The plain text password of the account.java.io.IOException
- If a network I/O error occurs in the process of
logging in.public boolean login(java.lang.String username, java.lang.String timestamp, java.lang.String secret) throws java.io.IOException, java.security.NoSuchAlgorithmException
You must first connect to the server with connect before attempting to login. A login attempt is only valid if the client is in the AUTHORIZATION_STATE . After logging in, the client enters the TRANSACTION_STATE . After connecting, you must parse out the server specific information to use as a timestamp, and pass that information to this method. The secret is a shared secret known to you and the server. See RFC 1939 for more details regarding the APOP command.
username
- The account name being logged in to.timestamp
- The timestamp string to combine with the secret.secret
- The shared secret which produces the MD5 digest when
combined with the timestamp.java.io.IOException
- If a network I/O error occurs in the process of
logging in.java.security.NoSuchAlgorithmException
- If the MD5 encryption algorithm
cannot be instantiated by the Java runtime system.public boolean logout() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process
of logging out.public boolean noop() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process of
sending the NOOP command.public boolean deleteMessage(int messageId) throws java.io.IOException
messageId
- The message number to delete.java.io.IOException
- If a network I/O error occurs in the process of
sending the delete command.public boolean reset() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process of
sending the reset command.public POP3MessageInfo status() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process of
sending the status command.public POP3MessageInfo listMessage(int messageId) throws java.io.IOException
messageId
- The number of the message list.java.io.IOException
- If a network I/O error occurs in the process of
sending the list command.public POP3MessageInfo[] listMessages() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process of
sending the list command.public POP3MessageInfo listUniqueIdentifier(int messageId) throws java.io.IOException
messageId
- The number of the message list.java.io.IOException
- If a network I/O error occurs in the process of
sending the list unique identifier command.public POP3MessageInfo[] listUniqueIdentifiers() throws java.io.IOException
java.io.IOException
- If a network I/O error occurs in the process of
sending the list unique identifier command.public java.io.Reader retrieveMessage(int messageId) throws java.io.IOException
You must not issue any commands to the POP3 server (i.e., call any other methods) until you finish reading the message from the returned Reader instance. The POP3 protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned Reader actually reads directly from the POP3 connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
messageId
- The number of the message to fetch.java.io.IOException
- If a network I/O error occurs in the process of
sending the retrieve message command.public java.io.Reader retrieveMessageTop(int messageId, int numLines) throws java.io.IOException
You must not issue any commands to the POP3 server (i.e., call any other methods) until you finish reading the message from the returned Reader instance. The POP3 protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned Reader actually reads directly from the POP3 connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
messageId
- The number of the message to fetch.numLines
- The top number of lines to fetch. This must be >= 0.java.io.IOException
- If a network I/O error occurs in the process of
sending the top command.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |