Java Doc for POP3Client.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » pop3 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.pop3 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.net.pop3.POP3
   org.apache.commons.net.pop3.POP3Client

POP3Client
public class POP3Client extends POP3 (Code)
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 org.apache.commons.net.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.


author:
   Daniel F. Savarese
See Also:   POP3MessageInfo
See Also:   org.apache.commons.net.io.DotTerminatedMessageReader
See Also:   org.apache.commons.net.MalformedServerReplyException





Method Summary
public  booleandeleteMessage(int messageId)
     Delete a message from the POP3 server.
public  POP3MessageInfolistMessage(int messageId)
     List an individual message.
public  POP3MessageInfo[]listMessages()
     List all messages.
public  POP3MessageInfolistUniqueIdentifier(int messageId)
     List the unique identifier for a message.
public  POP3MessageInfo[]listUniqueIdentifiers()
     List the unique identifiers for all messages.
public  booleanlogin(String username, String password)
     Login to the POP3 server with the given username and password.
public  booleanlogin(String username, String timestamp, String secret)
     Login to the POP3 server with the given username and authentication information.
public  booleanlogout()
     Logout of the POP3 server.
public  booleannoop()
     Send a NOOP command to the POP3 server.
public  booleanreset()
     Reset the POP3 session.
public  ReaderretrieveMessage(int messageId)
     Retrieve a message from the POP3 server.
public  ReaderretrieveMessageTop(int messageId, int numLines)
     Retrieve only the specified top number of lines of a message from the POP3 server.
public  POP3MessageInfostatus()
     Get the mailbox status.



Method Detail
deleteMessage
public boolean deleteMessage(int messageId) throws IOException(Code)
Delete a message from the POP3 server. The message is only marked for deletion by the server. If you decide to unmark the message, you must issuse a POP3Client.reset reset command. Messages marked for deletion are only deleted by the server on POP3Client.logout logout . A delete attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE .


Parameters:
  messageId - The message number to delete. True if the deletion attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the process ofsending the delete command.




listMessage
public POP3MessageInfo listMessage(int messageId) throws IOException(Code)
List an individual message. A list attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns a POP3MessageInfo instance containing the number of the listed message and the size of the message in bytes. Returns null if the list attempt fails (e.g., if the specified message number does not exist).


Parameters:
  messageId - The number of the message list. A POP3MessageInfo instance containing the number of thelisted message and the size of the message in bytes. Returnsnull if the list attempt fails.
exception:
  IOException - If a network I/O error occurs in the process ofsending the list command.




listMessages
public POP3MessageInfo[] listMessages() throws IOException(Code)
List all messages. A list attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns an array of POP3MessageInfo instances, each containing the number of a message and its size in bytes. If there are no messages, this method returns a zero length array. If the list attempt fails, it returns null.

An array of POP3MessageInfo instances representing all messagesin the order they appear in the mailbox,each containing the number of a message and its size in bytes.If there are no messages, this method returns a zero length array.If the list attempt fails, it returns null.
exception:
  IOException - If a network I/O error occurs in the process ofsending the list command.




listUniqueIdentifier
public POP3MessageInfo listUniqueIdentifier(int messageId) throws IOException(Code)
List the unique identifier for a message. A list attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns a POP3MessageInfo instance containing the number of the listed message and the unique identifier for that message. Returns null if the list attempt fails (e.g., if the specified message number does not exist).


Parameters:
  messageId - The number of the message list. A POP3MessageInfo instance containing the number of thelisted message and the unique identifier for that message.Returns null if the list attempt fails.
exception:
  IOException - If a network I/O error occurs in the process ofsending the list unique identifier command.




listUniqueIdentifiers
public POP3MessageInfo[] listUniqueIdentifiers() throws IOException(Code)
List the unique identifiers for all messages. A list attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns an array of POP3MessageInfo instances, each containing the number of a message and its unique identifier. If there are no messages, this method returns a zero length array. If the list attempt fails, it returns null.

An array of POP3MessageInfo instances representing all messagesin the order they appear in the mailbox,each containing the number of a message and its unique identifierIf there are no messages, this method returns a zero length array.If the list attempt fails, it returns null.
exception:
  IOException - If a network I/O error occurs in the process ofsending the list unique identifier command.




login
public boolean login(String username, String password) throws IOException(Code)
Login to the POP3 server with the given username and password. You must first connect to the server with org.apache.commons.net.SocketClient.connect connect before attempting to login. A login attempt is only valid if the client is in the org.apache.commons.net.pop3.POP3.AUTHORIZATION_STATE AUTHORIZATION_STATE . After logging in, the client enters the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE .


Parameters:
  username - The account name being logged in to.
Parameters:
  password - The plain text password of the account. True if the login attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the process oflogging in.




login
public boolean login(String username, String timestamp, String secret) throws IOException, NoSuchAlgorithmException(Code)
Login to the POP3 server with the given username and authentication information. Use this method when connecting to a server requiring authentication using the APOP command. Because the timestamp produced in the greeting banner varies from server to server, it is not possible to consistently extract the information. Therefore, after connecting to the server, you must call org.apache.commons.net.pop3.POP3.getReplyString getReplyString and parse out the timestamp information yourself.

You must first connect to the server with org.apache.commons.net.SocketClient.connect connect before attempting to login. A login attempt is only valid if the client is in the org.apache.commons.net.pop3.POP3.AUTHORIZATION_STATE AUTHORIZATION_STATE . After logging in, the client enters the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE 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.


Parameters:
  username - The account name being logged in to.
Parameters:
  timestamp - The timestamp string to combine with the secret.
Parameters:
  secret - The shared secret which produces the MD5 digest whencombined with the timestamp. True if the login attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the process oflogging in.
exception:
  NoSuchAlgorithmException - If the MD5 encryption algorithmcannot be instantiated by the Java runtime system.




logout
public boolean logout() throws IOException(Code)
Logout of the POP3 server. To fully disconnect from the server you must call org.apache.commons.net.pop3.POP3.disconnect disconnect . A logout attempt is valid in any state. If the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE , it enters the org.apache.commons.net.pop3.POP3.UPDATE_STATE UPDATE_STATE on a successful logout.

True if the logout attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the processof logging out.




noop
public boolean noop() throws IOException(Code)
Send a NOOP command to the POP3 server. This is useful for keeping a connection alive since most POP3 servers will timeout after 10 minutes of inactivity. A noop attempt will only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE .

True if the noop attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the process ofsending the NOOP command.




reset
public boolean reset() throws IOException(Code)
Reset the POP3 session. This is useful for undoing any message deletions that may have been performed. A reset attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE .

True if the reset attempt was successful, false if not.
exception:
  IOException - If a network I/O error occurs in the process ofsending the reset command.




retrieveMessage
public Reader retrieveMessage(int messageId) throws IOException(Code)
Retrieve a message from the POP3 server. A retrieve message attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns a DotTerminatedMessageReader instance from which the entire message can be read. Returns null if the retrieval attempt fails (e.g., if the specified message number does not exist).

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.


Parameters:
  messageId - The number of the message to fetch. A DotTerminatedMessageReader instancefrom which the entire message can be read.Returns null if the retrieval attempt fails (e.g., if the specifiedmessage number does not exist).
exception:
  IOException - If a network I/O error occurs in the process ofsending the retrieve message command.




retrieveMessageTop
public Reader retrieveMessageTop(int messageId, int numLines) throws IOException(Code)
Retrieve only the specified top number of lines of a message from the POP3 server. A retrieve top lines attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns a DotTerminatedMessageReader instance from which the specified top number of lines of the message can be read. Returns null if the retrieval attempt fails (e.g., if the specified message number does not exist).

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.


Parameters:
  messageId - The number of the message to fetch.
Parameters:
  numLines - The top number of lines to fetch. This must be >= 0. A DotTerminatedMessageReader instancefrom which the specified top number of lines of the message can beread.Returns null if the retrieval attempt fails (e.g., if the specifiedmessage number does not exist).
exception:
  IOException - If a network I/O error occurs in the process ofsending the top command.




status
public POP3MessageInfo status() throws IOException(Code)
Get the mailbox status. A status attempt can only succeed if the client is in the org.apache.commons.net.pop3.POP3.TRANSACTION_STATE TRANSACTION_STATE . Returns a POP3MessageInfo instance containing the number of messages in the mailbox and the total size of the messages in bytes. Returns null if the status the attempt fails.

A POP3MessageInfo instance containing the number ofmessages in the mailbox and the total size of the messagesin bytes. Returns null if the status the attempt fails.
exception:
  IOException - If a network I/O error occurs in the process ofsending the status command.




Fields inherited from org.apache.commons.net.pop3.POP3
final public static int AUTHORIZATION_STATE(Code)(Java Doc)
final public static int DEFAULT_PORT(Code)(Java Doc)
final public static int DISCONNECTED_STATE(Code)(Java Doc)
final public static int TRANSACTION_STATE(Code)(Java Doc)
final public static int UPDATE_STATE(Code)(Java Doc)
final static String _ERROR(Code)(Java Doc)
final static String _OK(Code)(Java Doc)
protected ProtocolCommandSupport _commandSupport_(Code)(Java Doc)
String _lastReplyLine(Code)(Java Doc)
BufferedReader _reader(Code)(Java Doc)
int _replyCode(Code)(Java Doc)
Vector _replyLines(Code)(Java Doc)

Methods inherited from org.apache.commons.net.pop3.POP3
protected void _connectAction_() throws IOException(Code)(Java Doc)
public void addProtocolCommandListener(ProtocolCommandListener listener)(Code)(Java Doc)
public void disconnect() throws IOException(Code)(Java Doc)
public void getAdditionalReply() throws IOException(Code)(Java Doc)
public String getReplyString()(Code)(Java Doc)
public String[] getReplyStrings()(Code)(Java Doc)
public int getState()(Code)(Java Doc)
public void removeProtocolCommandistener(ProtocolCommandListener listener)(Code)(Java Doc)
public int sendCommand(String command, String args) throws IOException(Code)(Java Doc)
public int sendCommand(String command) throws IOException(Code)(Java Doc)
public int sendCommand(int command, String args) throws IOException(Code)(Java Doc)
public int sendCommand(int command) throws IOException(Code)(Java Doc)
public void setState(int state)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.