| java.lang.Object sun.net.www.MessageHeader
MessageHeader | public class MessageHeader (Code) | | An RFC 844 or MIME message header. Includes methods
for parsing headers from incoming streams, fetching
values, setting values, and printing headers.
Key values of null are legal: they indicate lines in
the header that don't have a valid key, but do have
a value (this isn't legal according to the standard,
but lines like this are everywhere).
|
Inner Class :class HeaderIterator implements Iterator | |
MessageHeader | public MessageHeader()(Code) | | |
add | public synchronized void add(String k, String v)(Code) | | Adds a key value pair to the end of the
header. Duplicates are allowed
|
canonicalID | public static String canonicalID(String id)(Code) | | Convert a message-id string to canonical form (strips off
leading and trailing <>s)
|
findNextValue | public synchronized String findNextValue(String k, String v)(Code) | | Deprecated: Use multiValueIterator() instead.
Find the next value that corresponds to this key.
It finds the first value that follows v. To iterate
over all the values of a key use:
for(String v=h.findValue(k); v!=null; v=h.findNextValue(k, v)) {
...
}
|
findValue | public synchronized String findValue(String k)(Code) | | Find the value that corresponds to this key.
It finds only the first occurrence of the key.
Parameters: k - the key to find. null if not found. |
getHeaders | public synchronized Map getHeaders()(Code) | | |
multiValueIterator | public Iterator multiValueIterator(String k)(Code) | | return an Iterator that returns all values of a particular
key in sequence
|
prepend | public synchronized void prepend(String k, String v)(Code) | | Prepends a key value pair to the beginning of the
header. Duplicates are allowed
|
print | public synchronized void print(PrintStream p)(Code) | | Prints the key-value pairs represented by this
header. Also prints the RFC required blank line
at the end. Omits pairs with a null key.
|
reset | public synchronized void reset()(Code) | | Reset a message header (all key/values removed)
|
set | public synchronized void set(int i, String k, String v)(Code) | | Overwrite the previous key/val pair at location 'i'
with the new k/v. If the index didn't exist before
the key/val is simply tacked onto the end.
|
set | public synchronized void set(String k, String v)(Code) | | Sets the value of a key. If the key already
exists in the header, it's value will be
changed. Otherwise a new key/value pair will
be added to the end of the header.
|
setIfNotSet | public synchronized void setIfNotSet(String k, String v)(Code) | | Set's the value of a key only if there is no
key with that value already.
|
|
|