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

Variable Index

 o BCC
Key for header field 'Bcc'.
 o CC
Key for header field 'Cc'.
 o DATE
Key for header field 'Date'.
 o FROM
Key for header field 'From'.
 o ORGANIZATION
Key for header field 'Organization'.
 o PRIORITY
Key for header field 'Priority'.
 o REPLY_TO
Key for header field 'Reply-To'.
 o SUBJECT
Key for header field 'Subject'.
 o TO
Key for header field 'To'.

Constructor Index

 o Header()
Constructor for Header.

Method Index

 o addField(String, String)
Adds a header field with specified key and value.
 o appendField(String, String)
Appends a new header field with specified key and value.
 o clearAllFields()
Removes all the header fields.
 o getAllKeys()
Returns an enumeration of all the header keys.
 o getField(String)
Returns the value of the header field for the specified key.
 o putByteStream(OutputStream)
Writes the key/value pairs to an OutputStream.

Variables

 o DATE
 public static final String DATE
Key for header field 'Date'.

 o FROM
 public static final String FROM
Key for header field 'From'.

 o TO
 public static final String TO
Key for header field 'To'.

 o CC
 public static final String CC
Key for header field 'Cc'.

 o BCC
 public static final String BCC
Key for header field 'Bcc'.

 o SUBJECT
 public static final String SUBJECT
Key for header field 'Subject'.

 o PRIORITY
 public static final String PRIORITY
Key for header field 'Priority'.

 o ORGANIZATION
 public static final String ORGANIZATION
Key for header field 'Organization'.

 o REPLY_TO
 public static final String REPLY_TO
Key for header field 'Reply-To'.

Constructors

 o Header
 public Header()
Constructor for Header. Constructs a Header object without any keys and values.

Methods

 o 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
 o 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
 o clearAllFields
 public void clearAllFields()
Removes all the header fields.

 o getAllKeys
 public Enumeration getAllKeys()
Returns an enumeration of all the header keys.

Returns:
an enumeration of all the header keys.
 o 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.
 o 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