Methods Summary |
---|
public void | addField(org.apache.james.mime4j.field.Field field)Adds a field to the end of the list of fields.
List values = (List) fieldMap.get(field.getName().toLowerCase());
if (values == null) {
values = new LinkedList();
fieldMap.put(field.getName().toLowerCase(), values);
}
values.add(field);
fields.add(field);
|
public org.apache.james.mime4j.field.Field | getField(java.lang.String name)Gets a Field given a field name. If there are multiple
such fields defined in this header the first one will be returned.
List l = (List) fieldMap.get(name.toLowerCase());
if (l != null && !l.isEmpty()) {
return (Field) l.get(0);
}
return null;
|
public java.util.List | getFields()Gets the fields of this header. The returned list will not be
modifiable.
return Collections.unmodifiableList(fields);
|
public java.util.List | getFields(java.lang.String name)Gets all Field s having the specified field name.
List l = (List) fieldMap.get(name.toLowerCase());
return Collections.unmodifiableList(l);
|
public java.lang.String | toString()Return Header Object as String representation. Each headerline is
seperated by "\r\n"
StringBuffer str = new StringBuffer();
for (Iterator it = fields.iterator(); it.hasNext();) {
str.append(it.next().toString());
str.append("\r\n");
}
return str.toString();
|
public void | writeTo(java.io.OutputStream out)Write the Header to the given OutputStream
String charString = ((ContentTypeField) getField(Field.CONTENT_TYPE)).getCharset();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, CharsetUtil.getCharset(charString)),8192);
writer.write(toString()+ "\r\n");
writer.flush();
|