javax.mail.internet
Class InternetHeaders
java.lang.Object
javax.mail.internet.InternetHeaders
public class InternetHeaders
extends java.lang.Object
Class that represents the RFC822 headers associated with a message.
InternetHeaders() - Create an empty InternetHeaders
|
InternetHeaders(InputStream in) - Create a new InternetHeaders initialized by reading headers from the stream.
|
InternetHeaders
public InternetHeaders()
Create an empty InternetHeaders
InternetHeaders
public InternetHeaders(InputStream in)
throws MessagingException
Create a new InternetHeaders initialized by reading headers from the stream.
in
- the RFC822 input stream to load from
addHeader
public void addHeader(String name,
String value)
Add a new value to the header with the supplied name.
name
- the name of the header to add a new value forvalue
- another value
addHeaderLine
public void addHeaderLine(String line)
getAllHeaderLines
public Enumeration getAllHeaderLines()
getAllHeaders
public Enumeration getAllHeaders()
Return all headers.
getHeader
public String[] getHeader(String name)
Return all the values for the specified header.
name
- the header to return
- the values for that header, or null if the header is not present
getHeader
public String getHeader(String name,
String delimiter)
Return the values for the specified header as a single String.
If the header has more than one value then all values are concatenated
together separated by the supplied delimiter.
name
- the header to returndelimiter
- the delimiter used in concatenation
- the header as a single String
getMatchingHeaderLines
public Enumeration getMatchingHeaderLines(String[] names)
getMatchingHeaders
public Enumeration getMatchingHeaders(String[] names)
getNonMatchingHeaderLines
public Enumeration getNonMatchingHeaderLines(String[] names)
getNonMatchingHeaders
public Enumeration getNonMatchingHeaders(String[] names)
load
public void load(InputStream in)
throws MessagingException
Read and parse the supplied stream and add all headers to the current set.
in
- the RFC822 input stream to load from
removeHeader
public void removeHeader(String name)
Remove all header entries with the supplied name
name
- the header to remove
setHeader
public void setHeader(String name,
String value)
Set the value of the header to the supplied value; any existing
headers are removed.
name
- the name of the headervalue
- the new value