com.sun.mail.util.ReadableMime
, javax.mail.internet.MimePart
, javax.mail.Part
public class POP3Message
extends javax.mail.internet.MimeMessage
implements com.sun.mail.util.ReadableMime
Constructor | Description |
---|---|
POP3Message(javax.mail.Folder folder,
int msgno) |
Modifier and Type | Method | Description |
---|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
Add this value to the existing values for this header_name.
|
void |
addHeaderLine(java.lang.String line) |
Add a raw RFC822 header-line.
|
java.util.Enumeration<java.lang.String> |
getAllHeaderLines() |
Get all header lines as an Enumeration of Strings.
|
java.util.Enumeration<javax.mail.Header> |
getAllHeaders() |
Return all the headers from this Message as an enumeration
of Header objects.
|
protected java.io.InputStream |
getContentStream() |
Produce the raw bytes of the content.
|
java.lang.String[] |
getHeader(java.lang.String name) |
Get all the headers for this header_name.
|
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter) |
Get all the headers for this header name, returned as a single
String, with headers separated by the delimiter.
|
java.util.Enumeration<java.lang.String> |
getMatchingHeaderLines(java.lang.String[] names) |
Get matching header lines as an Enumeration of Strings.
|
java.util.Enumeration<javax.mail.Header> |
getMatchingHeaders(java.lang.String[] names) |
Return matching headers from this Message as an Enumeration of
Header objects.
|
java.io.InputStream |
getMimeStream() |
Return the MIME format stream corresponding to this message part.
|
java.util.Enumeration<java.lang.String> |
getNonMatchingHeaderLines(java.lang.String[] names) |
Get non-matching header lines as an Enumeration of Strings.
|
java.util.Enumeration<javax.mail.Header> |
getNonMatchingHeaders(java.lang.String[] names) |
Return non-matching headers from this Message as an
Enumeration of Header objects.
|
int |
getSize() |
Return the size of the content of this message in bytes.
|
void |
invalidate(boolean invalidateHeaders) |
Invalidate the cache of content for this message object, causing
it to be fetched again from the server the next time it is needed.
|
void |
removeHeader(java.lang.String name) |
Remove all headers with this name.
|
void |
saveChanges() |
POP3 message can't be changed.
|
void |
setFlags(javax.mail.Flags newFlags,
boolean set) |
Set the specified flags on this message to the specified value.
|
void |
setHeader(java.lang.String name,
java.lang.String value) |
Set the value for this header_name.
|
java.io.InputStream |
top(int n) |
Fetch the header of the message and the first
n lines
of the raw content of the message. |
void |
writeTo(java.io.OutputStream os,
java.lang.String[] ignoreList) |
Output the message as an RFC 822 format stream, without
specified headers.
|
addFrom, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getInputStream, getLineCount, getMessageID, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSubject, isMimeType, isSet, parse, reply, reply, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFrom, setFrom, setFrom, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo
public POP3Message(javax.mail.Folder folder, int msgno) throws javax.mail.MessagingException
javax.mail.MessagingException
public void setFlags(javax.mail.Flags newFlags, boolean set) throws javax.mail.MessagingException
setFlags
in class javax.mail.internet.MimeMessage
newFlags
- the flags to be setset
- the value to be setjavax.mail.MessagingException
public int getSize() throws javax.mail.MessagingException
Note that this number may not be an exact measure of the content size and may or may not account for any transfer encoding of the content.
getSize
in interface javax.mail.Part
getSize
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failuresprotected java.io.InputStream getContentStream() throws javax.mail.MessagingException
getContentStream
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.contentStream
public java.io.InputStream getMimeStream() throws javax.mail.MessagingException
getMimeStream
in interface com.sun.mail.util.ReadableMime
javax.mail.MessagingException
public void invalidate(boolean invalidateHeaders)
invalidateHeaders
is true, invalidate the headers
as well.invalidateHeaders
- invalidate the headers as well?public java.io.InputStream top(int n) throws javax.mail.MessagingException
n
lines
of the raw content of the message. The headers and data are
available in the returned InputStream.n
- number of lines of content to fetchjavax.mail.MessagingException
- for failurespublic java.lang.String[] getHeader(java.lang.String name) throws javax.mail.MessagingException
getHeader
in interface javax.mail.Part
getHeader
in class javax.mail.internet.MimeMessage
name
- name of headerjavax.mail.MessagingException
- for failuresMimeUtility
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws javax.mail.MessagingException
null
, only the first header is
returned.getHeader
in interface javax.mail.internet.MimePart
getHeader
in class javax.mail.internet.MimeMessage
name
- the name of this headerdelimiter
- delimiter between returned headersjavax.mail.MessagingException
- for failurespublic void setHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
setHeader
in interface javax.mail.Part
setHeader
in class javax.mail.internet.MimeMessage
name
- header namevalue
- header valuejavax.mail.IllegalWriteException
- because the underlying
implementation does not support modificationjava.lang.IllegalStateException
- if this message is
obtained from a READ_ONLY folder.javax.mail.MessagingException
- for other failuresMimeUtility
public void addHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
addHeader
in interface javax.mail.Part
addHeader
in class javax.mail.internet.MimeMessage
name
- header namevalue
- header valuejavax.mail.IllegalWriteException
- because the underlying
implementation does not support modificationjava.lang.IllegalStateException
- if this message is
obtained from a READ_ONLY folder.javax.mail.MessagingException
MimeUtility
public void removeHeader(java.lang.String name) throws javax.mail.MessagingException
removeHeader
in interface javax.mail.Part
removeHeader
in class javax.mail.internet.MimeMessage
javax.mail.IllegalWriteException
- because the underlying
implementation does not support modificationjava.lang.IllegalStateException
- if this message is
obtained from a READ_ONLY folder.javax.mail.MessagingException
public java.util.Enumeration<javax.mail.Header> getAllHeaders() throws javax.mail.MessagingException
Note that certain headers may be encoded as per RFC 2047 if they contain non US-ASCII characters and these should be decoded.
getAllHeaders
in interface javax.mail.Part
getAllHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failuresMimeUtility
public java.util.Enumeration<javax.mail.Header> getMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaders
in interface javax.mail.Part
getMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failurespublic java.util.Enumeration<javax.mail.Header> getNonMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaders
in interface javax.mail.Part
getNonMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failurespublic void addHeaderLine(java.lang.String line) throws javax.mail.MessagingException
addHeaderLine
in interface javax.mail.internet.MimePart
addHeaderLine
in class javax.mail.internet.MimeMessage
javax.mail.IllegalWriteException
- because the underlying
implementation does not support modificationjava.lang.IllegalStateException
- if this message is
obtained from a READ_ONLY folder.javax.mail.MessagingException
public java.util.Enumeration<java.lang.String> getAllHeaderLines() throws javax.mail.MessagingException
getAllHeaderLines
in interface javax.mail.internet.MimePart
getAllHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failurespublic java.util.Enumeration<java.lang.String> getMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaderLines
in interface javax.mail.internet.MimePart
getMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failurespublic java.util.Enumeration<java.lang.String> getNonMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaderLines
in interface javax.mail.internet.MimePart
getNonMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- for failurespublic void saveChanges() throws javax.mail.MessagingException
saveChanges
in class javax.mail.internet.MimeMessage
javax.mail.IllegalWriteException
- because the underlying
implementation does not support modificationjavax.mail.MessagingException
public void writeTo(java.io.OutputStream os, java.lang.String[] ignoreList) throws java.io.IOException, javax.mail.MessagingException
writeTo
in class javax.mail.internet.MimeMessage
java.io.IOException
- if an error occurs writing to the stream
or if an error is generated by the
javax.activation layer.javax.mail.MessagingException
- for other failuresDataHandler.writeTo(java.io.OutputStream)