public class MessageHeader extends Object
Constructor and Description |
---|
MessageHeader() |
MessageHeader(InputStream is) |
Modifier and Type | Method and Description |
---|---|
void |
add(String k,
String v)
Adds a key value pair to the end of the
header.
|
static String |
canonicalID(String id)
Convert a message-id string to canonical form (strips off leading and trailing <>s)
|
Map<String,List<String>> |
filterAndAddHeaders(String[] excludeList,
Map<String,List<String>> include) |
boolean |
filterNTLMResponses(String k)
Removes bare Negotiate and Kerberos headers when an "NTLM ..."
appears.
|
String |
findNextValue(String k,
String v)
Deprecated: Use multiValueIterator() instead.
|
String |
findValue(String k)
Find the value that corresponds to this key.
|
String |
getHeaderNamesInList()
Returns list of header names in a comma separated list
|
Map<String,List<String>> |
getHeaders() |
Map<String,List<String>> |
getHeaders(String[] excludeList) |
String |
getKey(int n) |
int |
getKey(String k) |
String |
getValue(int n) |
void |
mergeHeader(InputStream is)
Parse and merge a MIME header from an input stream.
|
Iterator<String> |
multiValueIterator(String k)
return an Iterator that returns all values of a particular
key in sequence
|
void |
parseHeader(InputStream is)
Parse a MIME header from an input stream.
|
void |
prepend(String k,
String v)
Prepends a key value pair to the beginning of the
header.
|
void |
print(PrintStream p)
Prints the key-value pairs represented by this
header.
|
void |
remove(String k)
Remove the key from the header.
|
void |
reset()
Reset a message header (all key/values removed)
|
void |
set(int i,
String k,
String v)
Overwrite the previous key/val pair at location 'i'
with the new k/v.
|
void |
set(String k,
String v)
Sets the value of a key.
|
void |
setIfNotSet(String k,
String v)
Set's the value of a key only if there is no
key with that value already.
|
String |
toString()
Returns a string representation of the object.
|
public MessageHeader()
public MessageHeader(InputStream is) throws IOException
IOException
public void add(String k, String v)
public static String canonicalID(String id)
public Map<String,List<String>> filterAndAddHeaders(String[] excludeList, Map<String,List<String>> include)
public boolean filterNTLMResponses(String k)
public String findNextValue(String k, String v)
for(String v=h.findValue(k); v!=null; v=h.findNextValue(k, v)) { ... }
public String findValue(String k)
k
- the key to find.public String getHeaderNamesInList()
public String getKey(int n)
public int getKey(String k)
public String getValue(int n)
public void mergeHeader(InputStream is) throws IOException
IOException
public Iterator<String> multiValueIterator(String k)
public void parseHeader(InputStream is) throws IOException
IOException
public void prepend(String k, String v)
public void print(PrintStream p)
public void remove(String k)
k
- the key to removepublic void reset()
public void set(int i, String k, String v)
public void set(String k, String v)
public void setIfNotSet(String k, String v)
public String toString()
Object
toString
method returns a
string that "textually represents" this object. The result should be a concise but informative
representation that is easy for a person to read. It is recommended that all subclasses override
this method.
The toString
method for class Object
returns a string consisting of the name of
the class of which the object is an instance, the at-sign character `@
', and the unsigned
hexadecimal representation of the hash code of the object. In other words, this method returns a
string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())