Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--injektilo.net.Pop3Connection
Copyright (c) 1998 Jason Diamond
sendangels@usa.net
http://www.geocities.com/ResearchTriangle/Thinktank/8343/
Field Summary | |
static int | APOP
Constant passed to setAuthentication . |
static int | AUTO
Constant passed to setAuthentication . |
static int | DEFAULT_PORT
|
static int | USER
Constant passed to setAuthentication . |
Constructor Summary | |
Pop3Connection()
|
Method Summary | |
boolean | authenticate(java.lang.String user,
java.lang.String pass)
Obtain authorization to access a mailbox. |
void | close()
Closes the connection. |
boolean | delete(int message)
Mark the specified message for deletion. |
int | getAuthentication()
Gets the authentication mechanism being used for this connection. |
Pop3InputStream | getInputStream()
Get a Pop3InputStream that can be used to retrieve a message from the server. |
int | getOctets()
This method needs docs. |
java.util.Vector | getOctetsVector()
This method needs docs. |
int | getTotalMessages()
Get the total number of messages available for retrieval. |
int | getTotalOctets()
Get the total size in octets of all the available messages. |
java.lang.String | getUid()
This method needs docs. |
java.util.Vector | getUidVector()
This method needs docs. |
boolean | list()
Return a Vector containing the size of each available message in octets. |
boolean | list(int m)
Get the size in octets of the specified message. |
boolean | noOp()
Send the NOOP command to the server. |
boolean | open(java.lang.String host,
int port)
Open a connection to the specified host and port. |
boolean | open(java.lang.String host)
Open a connection to the specified host using the default port. |
boolean | quit()
Send the QUIT command to the server. |
java.lang.String | readLine()
Get a line of text from the server. |
void | readTo(java.io.OutputStream os)
Read a previously specified message by the retrieve method and write its contents to the specified output stream. |
boolean | reset()
Restore any messages marked for deletion to their original state. |
boolean | retrieve(int message)
Start the retrieval of the specified message number. |
void | setAuthentication(int auth)
Sets the authentication mechanism to use for this connection. |
void | setDebugOut(java.io.OutputStream os)
Set the output stream that debug info should be printed to. |
void | setDebug(boolean on)
Set whether debug info should be printed to the debug output stream. |
boolean | status()
Check the status of a user's maildrop. |
boolean | top(int message,
int lines,
java.io.OutputStream os)
Retrieve the headers and specified amount of lines from the specified message. |
boolean | top(int m,
int n)
Retrieve the headers and the specified amount of lines from the body of a message. |
boolean | uidl()
Retrieve a vector of strings that can be used to uniquely identify each of the available messages. |
boolean | uidl(int m)
Retrieve a String that can be used to uniquely identify the specified message. |
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_PORT
public static final int AUTO
setAuthentication
. When
authentication is set to AUTO, the authenticate
method will first attempt to authenticate the user using the
APOP command only if a timestamp was presented when the
connection was opened. If not, or if the APOP fails for
some reason, the USER/PASS commands are used.public static final int USER
setAuthentication
. This is the
default value.public static final int APOP
setAuthentication
. Set it to this
value if you want to use the APOP command for authenticating the
user's identity. Without sending their password in the clear.
Note that most servers don't support this option.Constructor Detail |
public Pop3Connection()
Method Detail |
public void setAuthentication(int auth)
auth
- the authentication mechanism to usepublic int getAuthentication()
public boolean open(java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOException
host
- the domain name of the POP3 server
port
- the port to connect to on the hostpublic boolean open(java.lang.String host) throws java.net.UnknownHostException, java.io.IOException
host
- the domain name of the POP3 serverpublic boolean authenticate(java.lang.String user, java.lang.String pass) throws java.io.IOException
open
method. The
authentication mechanism (USER/PASS or APOP) is set using the
setAuthentication
method.
user
- the name of the account
pass
- the account's passwordpublic boolean status() throws java.io.IOException
getTotalMessages
and
getTotalOctets
.public int getTotalMessages()
status
method needs to be invoked before
this method will return any useful value.status
method hasn't been called or
an error occured when it was calledpublic int getTotalOctets()
status
method needs to be invoked before
this method will return any useful value.status
method hasn't been called
or an error occured when it waspublic boolean list() throws java.io.IOException
public java.util.Vector getOctetsVector()
public boolean list(int m) throws java.io.IOException
public int getOctets()
public void readTo(java.io.OutputStream os) throws java.io.IOException
os
- the output stream to write topublic boolean retrieve(int message) throws java.io.IOException
readLine
to get the message headers and text.
message
- the message number to retrievepublic Pop3InputStream getInputStream() throws java.io.IOException
retrieve(int)
. Do not use this in conjunction
with the readLine
method.public java.lang.String readLine() throws java.io.IOException
retrieve
or top
method. Any
byte-stuffed octets are removed.public boolean delete(int message) throws java.io.IOException
reset
method.
message
- the message number to mark for deletionpublic boolean noOp() throws java.io.IOException
public boolean reset() throws java.io.IOException
public boolean quit() throws java.io.IOException
public boolean top(int message, int lines, java.io.OutputStream os) throws java.io.IOException
message
- the message number to retrieve
lines
- the number of lines of text the should be retrieved
from the body of the messagepublic boolean top(int m, int n) throws java.io.IOException
readLine
method needs to be called
to get each line of the message after this method is called. Not
all servers implement this command.
message
- the message number to retrieve
lines
- the number of lines from the body to retrievepublic boolean uidl() throws java.io.IOException
public java.util.Vector getUidVector()
public boolean uidl(int m) throws java.io.IOException
message
- the message number to retrieve the uid forpublic java.lang.String getUid()
public void close() throws java.io.IOException
public void setDebug(boolean on)
on
- true if you want debugging on, false if notpublic void setDebugOut(java.io.OutputStream os)
true
if this
setting is to be used.
os
- the output stream to print debug info to.Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |