|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.james.mime4j.message.Header
public class Header
The header of an entity (see RFC 2045).
Constructor Summary | |
---|---|
Header()
Creates a new empty Header . |
|
Header(java.io.InputStream is)
Creates a new Header from the specified stream. |
Method Summary | |
---|---|
void |
addField(Field field)
Adds a field to the end of the list of fields. |
Field |
getField(java.lang.String name)
Gets a Field given a field name. |
java.util.List |
getFields()
Gets the fields of this header. |
java.util.List |
getFields(java.lang.String name)
Gets all Field s having the specified field name. |
int |
removeFields(java.lang.String name)
Removes all Field s having the specified field name. |
void |
setField(Field field)
Sets or replaces a field. |
java.lang.String |
toString()
Return Header Object as String representation. |
void |
writeTo(java.io.OutputStream out,
int mode)
Write the Header to the given OutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Header()
Header
.
public Header(java.io.InputStream is) throws MimeException, java.io.IOException
Header
from the specified stream.
is
- the stream to read the header from.
MimeException
java.io.IOException
Method Detail |
---|
public void addField(Field field)
field
- the field to add.public java.util.List getFields()
Field
objects.public Field getField(java.lang.String name)
Field
given a field name. If there are multiple
such fields defined in this header the first one will be returned.
name
- the field name (e.g. From, Subject).
null
if none found.public java.util.List getFields(java.lang.String name)
Field
s having the specified field name.
name
- the field name (e.g. From, Subject).
public int removeFields(java.lang.String name)
Field
s having the specified field name.
name
- the field name (e.g. From, Subject).
public void setField(Field field)
Header
does not already contain a header field of
the same name as the given field then it is added to the end of the list
of fields (same behavior as addField(Field)
). Otherwise the
first occurrence of a field with the same name is replaced by the given
field and all further occurrences are removed.
field
- the field to set.public java.lang.String toString()
toString
in class java.lang.Object
public void writeTo(java.io.OutputStream out, int mode) throws java.io.IOException, MimeException
Compatibility mode:
MessageUtils.LENIENT
: use charset of the Content-Type header
MessageUtils.STRICT_ERROR
: use US-ASCII and throw MimeException
if a non ASCII character is encountered
MessageUtils.STRICT_ERROR
: ignore non ASCII characters if encountered
out
- the OutputStream to write tomode
- compatibility mode:
MessageUtils.LENIENT
, MessageUtils.STRICT_ERROR
, MessageUtils.STRICT_IGNORE
java.io.IOException
- if case of an I/O error
MimeException
- if case of a MIME protocol violation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |