org.apache.james.core
Class MailHeaders

java.lang.Object
  extended by javax.mail.internet.InternetHeaders
      extended by org.apache.james.core.MailHeaders
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MailHeaders
extends javax.mail.internet.InternetHeaders
implements java.io.Serializable, java.lang.Cloneable

This interface defines a container for mail headers. Each header must use MIME format:

name: value
.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.InternetHeaders
javax.mail.internet.InternetHeaders.InternetHeader
 
Field Summary
 
Fields inherited from class javax.mail.internet.InternetHeaders
headers
 
Constructor Summary
MailHeaders()
          No argument constructor
MailHeaders(java.io.InputStream in)
          Constructor that takes an InputStream containing the contents of the set of mail headers.
 
Method Summary
 void addHeader(java.lang.String arg0, java.lang.String arg1)
          If the new header is a Return-Path we get sure that we add it to the top Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with a return-path in the middle.
protected  java.lang.Object clone()
           
 boolean isSet(java.lang.String name)
          Check if a particular header is present.
 boolean isValid()
          Check if all REQUIRED headers fields as specified in RFC 822 are present.
 void setHeader(java.lang.String arg0, java.lang.String arg1)
          If the new header is a Return-Path we get sure that we add it to the top Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with a return-path in the middle.
 byte[] toByteArray()
          Generate a representation of the headers as a series of bytes.
 void writeTo(java.io.OutputStream out)
          Write the headers to an output stream
 
Methods inherited from class javax.mail.internet.InternetHeaders
addHeaderLine, getAllHeaderLines, getAllHeaders, getHeader, getHeader, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, load, removeHeader
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailHeaders

public MailHeaders()
            throws javax.mail.MessagingException
No argument constructor

Throws:
javax.mail.MessagingException - if the super class cannot be properly instantiated

MailHeaders

public MailHeaders(java.io.InputStream in)
            throws javax.mail.MessagingException
Constructor that takes an InputStream containing the contents of the set of mail headers.

Parameters:
in - the InputStream containing the header data
Throws:
javax.mail.MessagingException - if the super class cannot be properly instantiated based on the stream
Method Detail

writeTo

public void writeTo(java.io.OutputStream out)
Write the headers to an output stream

Parameters:
writer - the stream to which to write the headers

toByteArray

public byte[] toByteArray()
Generate a representation of the headers as a series of bytes.

Returns:
the byte array containing the headers

isSet

public boolean isSet(java.lang.String name)
Check if a particular header is present.

Returns:
true if the header is present, false otherwise

addHeader

public void addHeader(java.lang.String arg0,
                      java.lang.String arg1)
If the new header is a Return-Path we get sure that we add it to the top Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with a return-path in the middle.

Overrides:
addHeader in class javax.mail.internet.InternetHeaders
See Also:
InternetHeaders.addHeader(java.lang.String, java.lang.String)

setHeader

public void setHeader(java.lang.String arg0,
                      java.lang.String arg1)
If the new header is a Return-Path we get sure that we add it to the top Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with a return-path in the middle.

Overrides:
setHeader in class javax.mail.internet.InternetHeaders
See Also:
InternetHeaders.setHeader(java.lang.String, java.lang.String)

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

isValid

public boolean isValid()
Check if all REQUIRED headers fields as specified in RFC 822 are present.

Returns:
true if the headers are present, false otherwise


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.