public class BasicHeader
extends java.lang.Object
Header
to provide a convienient way to access all
important headerfields defined in RFC822.Modifier and Type | Field and Description |
---|---|
static int |
HIGH
Priority value
|
static int |
HIGHEST
Priority value
|
static int |
LOW
Priority value
|
static int |
LOWEST
Priority value
|
static int |
NORMAL
Priority value
|
Constructor and Description |
---|
BasicHeader(Header header)
Constructs a BasicHeader from a
Header |
Modifier and Type | Method and Description |
---|---|
int |
count() |
java.lang.String |
get(java.lang.String key)
Get the header with the specified key.
|
Address[] |
getBcc()
Gets the field "Bcc" from the header and uses the
AddressParser
to return a parsed Address list |
Address |
getBeenThere()
Gets the field "X-BeenThere" from the header and uses the
AddressParser to return a parsed Address list |
Address[] |
getCc()
Gets the field "Cc" from the header and uses the
AddressParser to
return a parsed Address list |
java.util.Date |
getDate()
Gets the field "Date" from the header and uses the
DateParser to
parse it into a Date object. |
Address |
getFrom()
Gets the field "From" from the header and uses the
AddressParser
to return a parsed Address list |
java.lang.String[] |
getInReplyTo()
Gets the field "In-Reply-To" from the header and splits the list in an
Array of message-ids
|
java.util.Enumeration<java.lang.String> |
getKeys()
Get all keys from the header.
|
java.lang.String |
getMessageID()
Gets the field "Message-ID" from the header
|
int |
getPriority()
Gets the field "X-Priority" from the header and converts the value to an
int.
|
java.lang.String[] |
getReferences()
Gets the field "References" from the header and splits the list in an
Array of message-ids
|
Address[] |
getReplyTo()
Gets the field "Reply-To" from the header and uses the
AddressParser to return a parsed Address list |
Address |
getSender()
Gets the field "Sender" from the header and uses the
AddressParser to return a parsed Address list |
java.lang.String |
getSubject()
Gets the field "Subject" from the header and uses the
EncodedWord
to decode an encoded subject. |
Address[] |
getTo()
Gets the field "To" from the header and uses the
AddressParser to
return a parsed Address list |
static java.lang.String |
removeComments(java.lang.String value)
Remove any comments as defined in RFC2822 from the String.
|
void |
set(java.lang.String key,
java.lang.Object value)
Set the header with the specified key.
|
void |
setBcc(Address[] addresses)
Sets the field "Bcc" of the header and uses
EncodedWord to encode
names if needed in UTF-8 using QuotedPrintable encoding. |
void |
setCc(Address[] addresses)
Sets the field "Cc" of the header and uses
EncodedWord to encode
names if needed in UTF-8 using QuotedPrintable encoding. |
void |
setDate(java.util.Date date)
Sets the field "Date" of the header by using
MessageDate to
convert the Date object into a RFC2822 compatible date string |
void |
setFrom(Address address)
Sets the field "From" of the header and uses
EncodedWord to
encode names if needed in UTF-8 using QuotedPrintable encoding. |
void |
setInReplyTo(java.lang.String[] messageids)
Sets the field "In-Reply-To" of the header.
|
void |
setMessageID(java.lang.String messageid)
Sets the field "Message-ID" of the header.
|
void |
setPriority(int priority)
Sets the field "X-Priority" of the header.
|
void |
setReferences(java.lang.String[] messageids)
Sets the field "References" of the header.
|
void |
setReplyTo(Address[] addresses)
Sets the field "Reply-To" of the header and uses
EncodedWord to
encode names if needed in UTF-8 using QuotedPrintable encoding. |
void |
setSubject(java.lang.String subject,
java.nio.charset.Charset charset)
Sets the field "Subject" of the header using
EncodedWord to
encode the subject with the given charset (e.g. |
void |
setTo(Address[] addresses)
Sets the field "To" of the header and uses
EncodedWord to encode
names if needed in UTF-8 using QuotedPrintable encoding. |
public static final int HIGHEST
public static final int HIGH
public static final int NORMAL
public static final int LOW
public static final int LOWEST
public Address getFrom()
AddressParser
to return a parsed Address
listpublic Address getSender()
AddressParser
to return a parsed Address
listpublic Address getBeenThere()
AddressParser
to return a parsed Address
listpublic Address[] getTo()
AddressParser
to
return a parsed Address
listpublic Address[] getCc()
AddressParser
to
return a parsed Address
listpublic Address[] getBcc()
AddressParser
to return a parsed Address
listpublic Address[] getReplyTo()
AddressParser
to return a parsed Address
listpublic java.lang.String getSubject()
EncodedWord
to decode an encoded subject.public java.lang.String getMessageID()
public java.lang.String[] getReferences()
public java.lang.String[] getInReplyTo()
public int getPriority()
NORMAL
priority is returned.public java.util.Date getDate()
DateParser
to
parse it into a Date
object. If an error occurs the current date
is returned.public void setFrom(Address address)
EncodedWord
to
encode names if needed in UTF-8 using QuotedPrintable encoding. We chose
UTF-8 to cover any possible characters.address
- mailaddresses with or without namespublic void setTo(Address[] addresses)
EncodedWord
to encode
names if needed in UTF-8 using QuotedPrintable encoding. We chose UTF-8
to cover any possible characters.addresses
- mailaddresses with or without namespublic void setCc(Address[] addresses)
EncodedWord
to encode
names if needed in UTF-8 using QuotedPrintable encoding. We chose UTF-8
to cover any possible characters.addresses
- mailaddresses with or without namespublic void setBcc(Address[] addresses)
EncodedWord
to encode
names if needed in UTF-8 using QuotedPrintable encoding. We chose UTF-8
to cover any possible characters.addresses
- mailaddresses with or without namespublic void setReplyTo(Address[] addresses)
EncodedWord
to
encode names if needed in UTF-8 using QuotedPrintable encoding. We chose
UTF-8 to cover any possible characters.addresses
- mailaddresses with or without namespublic void setDate(java.util.Date date)
MessageDate
to
convert the Date
object into a RFC2822 compatible date stringdate
- of the message creationpublic void setMessageID(java.lang.String messageid)
messageid
- unique id of this messagepublic void setReferences(java.lang.String[] messageids)
messageids
- the messageids of the messages this message refers tosetInReplyTo(java.lang.String[])
public void setInReplyTo(java.lang.String[] messageids)
messageids
- the messageids of the messages this message refers tosetReferences(java.lang.String[])
public void setPriority(int priority)
priority
- of the messagepublic void setSubject(java.lang.String subject, java.nio.charset.Charset charset)
EncodedWord
to
encode the subject with the given charset (e.g. ISO-8859-1) and Quoted-
Printable encoding.subject
- of the messagecharset
- the subject is encoded inpublic int count()
public java.lang.String get(java.lang.String key)
key
- public void set(java.lang.String key, java.lang.Object value)
key
- value
- public static final java.lang.String removeComments(java.lang.String value)
value
- public java.util.Enumeration<java.lang.String> getKeys()
Copyright © 2021. All Rights Reserved.