Constructor and Description |
---|
AbstractHeader()
Creates a new empty
Header . |
AbstractHeader(Header other)
Creates a new
Header from the specified
Header . |
Modifier and Type | Method and Description |
---|---|
void |
addField(Field field)
Adds a field to the end of the list of fields.
|
Field |
getField(String name)
Gets a
Field given a field name. |
List<Field> |
getFields()
Gets the fields of this header.
|
List<Field> |
getFields(String name)
Gets all
Field s having the specified field name. |
Iterator<Field> |
iterator()
Returns an iterator over the list of fields of this header.
|
int |
removeFields(String name)
Removes all
Field s having the specified field name. |
void |
setField(Field field)
Sets or replaces a field.
|
String |
toString()
Return Header Object as String representation.
|
public AbstractHeader()
Header
.public AbstractHeader(Header other)
Header
from the specified
Header
. The Header
instance is initialized
with a copy of the list of Field
s of the specified
Header
. The Field
objects are not copied
because they are immutable and can safely be shared between headers.other
- header to copy.public void addField(Field field)
public List<Field> getFields()
public Field getField(String name)
Field
given a field name. If there are multiple
such fields defined in this header the first one will be returned.public List<Field> getFields(String name)
Field
s having the specified field name.public Iterator<Field> iterator()
public int removeFields(String name)
Field
s having the specified field name.removeFields
in interface Header
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.Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.