All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.network.mail.base.Header
java.lang.Object
|
+----com.ibm.network.mail.base.Header
- public class Header
- extends Object
- implements MimeStreamWriter
Header
class represents the header of a message. It contains
name/value pairs containing header keys and their values. The key names are
case insensitive.
The standard message header fields are defined as static constant
attributes of this class. A user defined header field can be added using
addField
or appendField
methods.
- Author:
- Abdul Majeed Ghadialy, Mohit M Sant
- See Also:
- MimeMessage, MimeBodyPart, MimeMultipart, MimeStreamWriter
-
BCC
- Key for header field 'Bcc'.
-
CC
- Key for header field 'Cc'.
-
DATE
- Key for header field 'Date'.
-
FROM
- Key for header field 'From'.
-
ORGANIZATION
- Key for header field 'Organization'.
-
PRIORITY
- Key for header field 'Priority'.
-
REPLY_TO
- Key for header field 'Reply-To'.
-
SUBJECT
- Key for header field 'Subject'.
-
TO
- Key for header field 'To'.
-
Header()
- Constructor for
Header
.
-
addField(String, String)
- Adds a header field with specified key and value.
-
appendField(String, String)
- Appends a new header field with specified key and value.
-
clearAllFields()
- Removes all the header fields.
-
getAllKeys()
- Returns an enumeration of all the header keys.
-
getField(String)
- Returns the value of the header field for the specified key.
-
putByteStream(OutputStream)
- Writes the key/value pairs to an
OutputStream
.
DATE
public static final String DATE
- Key for header field 'Date'.
FROM
public static final String FROM
- Key for header field 'From'.
TO
public static final String TO
- Key for header field 'To'.
CC
public static final String CC
- Key for header field 'Cc'.
BCC
public static final String BCC
- Key for header field 'Bcc'.
SUBJECT
public static final String SUBJECT
- Key for header field 'Subject'.
PRIORITY
public static final String PRIORITY
- Key for header field 'Priority'.
ORGANIZATION
public static final String ORGANIZATION
- Key for header field 'Organization'.
REPLY_TO
public static final String REPLY_TO
- Key for header field 'Reply-To'.
Header
public Header()
- Constructor for
Header
.
Constructs a Header
object without any keys and values.
addField
public synchronized void addField(String key,
String value)
- Adds a header field with specified key and value.
If the header field with
key
as name
is already
present, the old value will be overwritten with value
.
- Parameters:
- name - header field key.
- value - header field value.
- See Also:
- appendField
appendField
public void appendField(String key,
String value)
- Appends a new header field with specified key and value.
Does not check if a field with the same key is already present.
- Parameters:
- name - header field key.
- value - header field value.
- See Also:
- addField
clearAllFields
public void clearAllFields()
- Removes all the header fields.
getAllKeys
public Enumeration getAllKeys()
- Returns an enumeration of all the header keys.
- Returns:
- an enumeration of all the header keys.
getField
public String getField(String fieldName)
- Returns the value of the header field for the specified key.
- Parameters:
- fieldName - header field key.
- Returns:
- header field value.
putByteStream
public void putByteStream(OutputStream os) throws IOException
- Writes the key/value pairs to an
OutputStream
.
The format is
key1: value1
key2: value2
...
- Parameters:
- os - the OutputStream to write to.
- Throws: IOException
- if an IO error is encoutered while writing to
OutputStream
.
- See Also:
- MimeStreamWriter
All Packages Class Hierarchy This Package Previous Next Index