All Packages Class Hierarchy This Package Previous Next Index
Class netscape.messaging.pop3.POP3Client
java.lang.Object
|
+----netscape.messaging.pop3.POP3Client
- public class POP3Client
- extends Object
The POP3Client class represents the POP3 client.
The client uses this class for communicating with a
server using the POP3 protocol.
The POP3 client conforms to the client specifications
described in RFC 1939. For the URL,
see "Where to Find More Information" in "About This Book."
-
POP3Client(IPOP3Sink)
- Constructor for POP3Client that takes a POP3Sink as a parameter.
-
connect(String)
- Connects to the server using the default port.
-
connect(String, int)
- Connects to the server using the specified port.
-
delete(int)
- Deletes a message.
-
disconnect()
- Closes the socket connection with the server.
-
list()
- Lists all messages.
-
list(int)
- List a message.
-
noop()
- Gets positive server response; does not affect POP3 session.
-
pass(String)
- Enters a password.
-
processResponses()
- Reads in responses from the server and invokes the appropriate sink methods.
-
quit()
- Closes the connection with the server and expunges any deleted messages.
-
reset()
- Resets the state of the server by undeleting any deleted messages.
-
retrieve(int)
- Retrieves a message.
-
sendCommand(String, boolean)
- Sends an unsupported command to the server.
-
setChunkSize(int)
- Sets the size of the data chunks that are passed to the response sink
for the retrieve() callback.
-
setResponseSink(IPOP3Sink)
- Registers a new response sink, overriding the one passed into the
constructor or any set afterwards.
-
setTimeout(int)
- Sets the amount of time allowed to wait before
returning control to the user.
-
stat()
- Gets the status of the mail drop.
-
top(int, int)
- Retrieves headers plus the specified number of lines from the body.
-
uidList()
- Lists all messages with their unique-ids.
-
uidList(int)
- Lists a message with its unique id.
-
user(String)
- Enters a username.
-
xAuthList()
- Returns a list of authenticated users.
-
xAuthList(int)
- Returns a list of authenticated users for a specified message.
-
xSender(int)
- Gets the email address of the sender of the specified message.
POP3Client
public POP3Client(IPOP3Sink in_sink)
- Constructor for POP3Client that takes a POP3Sink as a parameter.
- Parameters:
- in_sink - Response sink that implements the IPOP3Sink interface.
- See Also:
- IPOP3Sink
connect
public synchronized void connect(String in_server) throws IOException
- Connects to the server using the default port.
To specify the connection port, use the
form of connect that takes a port number.
- Parameters:
- in_server - Name of the host server to connect to.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- connect, error, quit, connect
connect
public synchronized void connect(String in_server,
int in_port) throws IOException
- Connects to the server using the specified port.
To use the default connection port, use the
form of connect that takes only the server name.
- Parameters:
- in_server - Name of the host server to connect to.
- in_port - Number of the port to connect to.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- connect, error, quit, connect
delete
public synchronized void delete(int in_messageNumber) throws IOException
- Deletes a message.
Marks a message for deletion on the server;
actually deleted when quit() is called.
- Parameters:
- in_messageNumber - Number of the message to delete.
- Throws: IOException
- If an IO error occurs.
- See Also:
- delete, error, quit
disconnect
public synchronized void disconnect() throws IOException
- Closes the socket connection with the server.
Can be used to perform a high level "Cancel" while
retrieving a message.
NOTE: Do not call processResponses() after this method.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- delete, quit
list
public synchronized void list() throws IOException
- Lists all messages.
POP3 includes two forms of LIST. This form goes through all
the messages in the mailbox and generates a list of messages.
The other form takes the message number of the message to
list as an argument.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- listStart, list, listComplete, error, list
list
public synchronized void list(int in_messageNumber) throws IOException
- List a message.
POP3 includes two forms of LIST.
This form takes the message number of the message to list
as an argument. The other form goes through all the messages
in the mailbox and generates a list of messages.
- Parameters:
- in_messageNumber - The message number to list.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- listStart, list, listComplete, error, list
noop
public synchronized void noop() throws IOException
- Gets positive server response; does not affect POP3 session.
Issues Noop command.
Server responds to commands with a "still here" response.
Sending the noop method does nothing except force this server response.
Can be used to maintain server connection, perhaps being issued
at timed intervals to make sure that the server is still active.
Not needed by applications that do not need to maintain the connection.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- noop, error
pass
public synchronized void pass(String in_password) throws IOException
- Enters a password.
Identifies the user password; on success, the POP3
session enters the Transaction state.
- Parameters:
- in_password - User password.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- pass, error, user
quit
public synchronized void quit() throws IOException
- Closes the connection with the server and expunges any deleted messages.
Ends the session, purging deleted messages and logging the user
out from the POP3 server. If issued in Authentication state,
server closes connections. If issued in Transaction state,
server goes into Update state and deletes marked messages,
then quits.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- quit, error, delete
reset
public synchronized void reset() throws IOException
- Resets the state of the server by undeleting any deleted messages.
Cancels the current mail transfer and all current processes,
discards data, and clears all states.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- reset, error
retrieve
public synchronized void retrieve(int in_messageNumber) throws IOException
- Retrieves a message.
- Parameters:
- in_messageNumber - Number of message to retrieve.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- retrieve, retrieveComplete, retrieveStart, error
sendCommand
public synchronized void sendCommand(String in_command,
boolean in_multiLine) throws IOException
- Sends an unsupported command to the server.
Sends commands that are not supported by the Messaging Access SDK
implementation of POP3.
NOTE: This method is primarily intended to support extensions
to the protocol to meet client application needs.
- Parameters:
- in_command - Raw command to send to the server.
- in_multiLine - Identifies whether response is multiline or not.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- sendCommand, sendCommandStart, sendCommandComplete, error
stat
public synchronized void stat() throws IOException
- Gets the status of the mail drop.
Returns the number of messages and octet size of the mail drop.
Always returns message octet count.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- stat, error
top
public synchronized void top(int in_messageNumber,
int in_lines) throws IOException
- Retrieves headers plus the specified number of lines from the body.
- Parameters:
- in_messageNumber - Number of message to retrieve.
- in_lines - Number of lines of the message body to return.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- topStart, top, topComplete, error
uidList
public synchronized void uidList() throws IOException
- Lists all messages with their unique-ids.
POP3 includes two forms of uidList(). This form goes through all
the messages in the mailbox and generates a list of messages
with their unique ids.
The other form takes the message number of the message to
list as an argument.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- uidList, uidListStart, uidListComplete, error
uidList
public synchronized void uidList(int in_messageNumber) throws IOException
- Lists a message with its unique id.
POP3 includes two forms of uidList(). This form takes the message number of the message to
list with its unique id as an argument.
The other form goes through all
the messages in the mailbox and generates a list of messages.
- Parameters:
- in_messageNumber - Number of message for which to return a unique id. .
- Throws: IOException
- If an I/O error occurs.
- See Also:
- uidList, uidListStart, uidListComplete, error
user
public synchronized void user(String in_user) throws IOException
- Enters a username.
Identifies the user or mail drop by name to the server;
the server returns a known or unknown response.
- Parameters:
- in_user - Name of the user's maildrop.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- user, error, pass
xAuthList
public synchronized void xAuthList() throws IOException
- Returns a list of authenticated users.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- xAuthList, xAuthListStart, xAuthListComplete, error
xAuthList
public synchronized void xAuthList(int in_messageNumber) throws IOException
- Returns a list of authenticated users for a specified message.
- Parameters:
- in_messageNumber - The message number.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- xAuthList, xAuthListStart, xAuthListComplete, error
xSender
public synchronized void xSender(int in_messageNumber) throws IOException
- Gets the email address of the sender of the specified message.
Gets the email address of the sender of the specified message.
Sends the XSENDER [arg] POP3 protocol command.
- Parameters:
- in_messageNumber - Number of the message.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- xSender, error
processResponses
public void processResponses() throws IOException
- Reads in responses from the server and invokes the appropriate sink methods.
Processes the server responses for API commands. Invokes the
callback methods provided by the user for all responses that
are available at the time of execution.
NOTE: If a timeout occurs, the user can continue by calling processResponses() again.
- Returns:
- int The number of responses processed.
- Throws: POP3ServerException
- If a server response error occurs.
- Throws: InterruptedIOException
- If a time-out occurs.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- error
setChunkSize
public synchronized void setChunkSize(int in_chunkSize)
- Sets the size of the data chunks that are passed to the response sink
for the retrieve() callback. The chunk size must be >= 1024.
- Parameters:
- in_chunkSize - Size of chunk used for sending messages using
the send method. Minimum chunk size: 1024. Default = 1K.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- retrieve
setResponseSink
public synchronized void setResponseSink(IPOP3Sink in_responseSink)
- Registers a new response sink, overriding the one passed into the
constructor or any set afterwards.
Server reponses are routed to this new response sink.
- Parameters:
- in_responseSink - New POP3 response sink to use.
- Throws: IOException
- If an I/O error occurs.
setTimeout
public synchronized void setTimeout(int in_timeout) throws IOException
- Sets the amount of time allowed to wait before
returning control to the user.
- Parameters:
- in_timeout - Time-out period to set in milliseconds.
Values, in milliseconds:
- 0 = infinite time-out (default)
- -1 = no waiting
- > 0 = length of time-out period
- Throws: IOException
- If an I/O error occurs.
- See Also:
- processResponses
All Packages Class Hierarchy This Package Previous Next Index