Class net.www.html.MessageHeader
All Packages This Package Previous Next
Class net.www.html.MessageHeader
java.lang.Object
|
+----net.www.html.MessageHeader
-
public class
MessageHeader
-
extends Object
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).
-
MessageHeader()
-
-
MessageHeader(InputStream)
-
-
add(String, String)
-
Adds a key value pair to the end of the
header.
-
canonicalID(String)
-
Convert a message-id string to canonical form (strips off
leading and trailing <>s)
-
findNextValue(String, String)
-
Find the next value that corresponds to this key.
-
findValue(String)
-
Find the value that corresponds to this key.
-
parseHeader(InputStream)
-
Parse a MIME header from an input stream.
-
print(PrintStream)
-
Prints the key-value pairs represented by this
header.
-
set(String, String)
-
Sets the value of a key.
MessageHeader
public MessageHeader()
MessageHeader
public MessageHeader(InputStream is)
findValue
public String findValue(String k)
-
Find the value that corresponds to this key.
It finds only the first occurrance of the key.
Returns null if not found.
findNextValue
public String findNextValue(String k,
String v)
-
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)) {
...
}
print
public void print(PrintStream p)
-
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.
add
public void add(String k,
String v)
-
Adds a key value pair to the end of the
header. Duplicates are allowed
set
public void set(String k,
String v)
-
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.
canonicalID
public String canonicalID(String id)
-
Convert a message-id string to canonical form (strips off
leading and trailing <>s)
parseHeader
public void parseHeader(InputStream is)
-
Parse a MIME header from an input stream.
All Packages This Package Previous Next