|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.ibm.wbi.util.MimeHeaderAscii
The MimeHeaderAscii class represents an RFC822-like
MIME header, and includes several performace considerations, such
as ASCII encoding and decoding, and fast case-insensitive header
storage and lookup.
| Field Summary | |
protected boolean |
cached
|
protected CIHashtable |
h
|
protected java.lang.String |
header
|
protected FastTokenizer |
lineTok
|
| Constructor Summary | |
MimeHeaderAscii()
Generate a new, empty MimeHeaderAscii. |
|
MimeHeaderAscii(byte[] h)
Generate a new MimeHeaderAscii from a buffer of
bytes representing ASCII characters. |
|
MimeHeaderAscii(byte[] h,
int offset,
int length)
Generate a new MimeHeaderAscii from a buffer of
bytes representing ASCII characters. |
|
MimeHeaderAscii(MimeHeaderAscii old)
Generate a new MimeHeaderAscii that is a copy of
another. |
|
MimeHeaderAscii(java.lang.String s)
Generate a new MimeHeaderAscii. |
|
| Method Summary | |
void |
add(java.lang.String key,
HeaderField value)
Set the value for a header field, adding to any previous values. |
void |
add(java.lang.String key,
java.lang.String value)
Set the value for a header field, adding to any previous values. |
byte[] |
asciiGetBytes()
Return an ASCII-encoded byte-array representation of this MimeHeaderAscii. |
static byte[] |
asciiGetBytes(java.lang.String s)
Return an ASCII-encoded byte-array representation of the specified string. |
java.lang.Object |
clone()
Return a clone of this MimeHeaderAscii. |
java.lang.String |
get(java.lang.String key)
Get the value for a header field. |
java.util.Vector |
getAll(java.lang.String key)
Get all values for a header field. |
java.lang.Object |
getRaw(java.lang.String key)
Get the value for a header field. |
protected void |
internalParseHeader()
Parse the Header and initialize values. |
protected void |
internalParseLine(java.lang.String line)
Parse a header line and store its value. |
java.util.Enumeration |
keys()
Return a list of all the header keys in this header. |
static void |
main(java.lang.String[] argv)
Test driver |
java.util.Vector |
parseAllHeaderFields(java.lang.String key)
Like parseHeader(String), but returns a
Vector of HeaderFields, one per
instance of the named header field, even if the header field
occurs zero or one times. |
java.util.Vector |
parseAllSplitHeaderFields(java.lang.String key)
Calls parseAllSplitHeaderFields(String key, char delim)
using the delimiter ",". |
java.util.Vector |
parseAllSplitHeaderFields(java.lang.String key,
char delim)
Like parseAllHeaderFields(String key)
|
HeaderField |
parseHeaderField(java.lang.String key)
Return the first value of the header field named by key as a parsed HeaderField object. |
boolean |
remove(java.lang.String key)
Remove all value(s) for a header field. |
void |
set(java.lang.String key,
HeaderField value)
Set the value for a header field, replacing any previous value(s). |
void |
set(java.lang.String key,
java.lang.String value)
Set the value for a header field, replacing any previous value(s). |
java.lang.String |
toString()
Return a String representation of this header,
which is a valid MIME header, including empty-line termination. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String header
protected boolean cached
protected CIHashtable h
protected FastTokenizer lineTok
| Constructor Detail |
public MimeHeaderAscii()
MimeHeaderAscii.
public MimeHeaderAscii(byte[] h)
throws MalformedHeaderException
MimeHeaderAscii from a buffer of
bytes representing ASCII characters.h - The ASCII-encoded bytes of the header
public MimeHeaderAscii(byte[] h,
int offset,
int length)
throws MalformedHeaderException
MimeHeaderAscii from a buffer of
bytes representing ASCII characters.h - The ASCII-encoded bytes of the headeroffset - The offset within h at which the
header beginslength - The length of the header in h
public MimeHeaderAscii(java.lang.String s)
throws MalformedHeaderException
MimeHeaderAscii.s - The header textpublic MimeHeaderAscii(MimeHeaderAscii old)
MimeHeaderAscii that is a copy of
another.old - The header to copy.| Method Detail |
public java.lang.Object clone()
MimeHeaderAscii.clone in class java.lang.Objectpublic java.util.Enumeration keys()
Enumerationpublic java.lang.String get(java.lang.String key)
key - The case-insensitive name of the header fieldString value to which
key is mapped, null if
key is unmapped, or the first value if
key is mapped to multiple values.public java.util.Vector getAll(java.lang.String key)
key - The case-insensitive name of the header fieldVector containing all
String values to which the key is mapped, even if
zero or one.public java.lang.Object getRaw(java.lang.String key)
key - The case-insensitive name of the header fieldnull if key is unmapped, or a
HeaderField representing the single value to which
key is mapped, or the Vector
containing the one or more values to which key is
mapped.public HeaderField parseHeaderField(java.lang.String key)
key as a parsed HeaderField object.
If that HeaderField object is modified, then
set() must be used to update the header itself:
the HeaderField object is a copy, not a reference.key - The name of the header field.HeaderField.set(String, HeaderField),
HeaderFieldpublic java.util.Vector parseAllHeaderFields(java.lang.String key)
parseHeader(String), but returns a
Vector of HeaderFields, one per
instance of the named header field, even if the header field
occurs zero or one times.key - The name of the header field.Vector of parsed HeaderFieldsparseHeaderField(String)
public java.util.Vector parseAllSplitHeaderFields(java.lang.String key,
char delim)
parseAllHeaderFields(String key)Accept: a/b, c/d would produce a vector of
two HeaderField objects, one representing a/b, the
other representing c/d.key - The name of the header field.Vector of HeaderField
objects.parseHeaderField(String),
parseAllHeaderFields(String key)public java.util.Vector parseAllSplitHeaderFields(java.lang.String key)
parseAllSplitHeaderFields(String key, char delim)
using the delimiter ",".key - the name of the header field.Vector of HeaderField
objects.parseHeaderField(String),
parseAllSplitHeaderFields(String, char)
public void set(java.lang.String key,
java.lang.String value)
key - The case-insensitive name of the header field.value - The new value for the field.
public void set(java.lang.String key,
HeaderField value)
key - The case-insensitive name of the header field.value - The new value for the field.
public void add(java.lang.String key,
java.lang.String value)
key - The case-insensitive name of the header field.value - The new value to add.
public void add(java.lang.String key,
HeaderField value)
key - The case-insensitive name of the header field.value - The new value to add.public boolean remove(java.lang.String key)
key - The case-insensitive name of the header fieldtrue if all values were removed,
false if key already had no value.public java.lang.String toString()
String representation of this header,
which is a valid MIME header, including empty-line termination.toString in class java.lang.ObjectStringpublic static byte[] asciiGetBytes(java.lang.String s)
s - The stringpublic byte[] asciiGetBytes()
MimeHeaderAscii.
protected void internalParseHeader()
throws MalformedHeaderException
protected void internalParseLine(java.lang.String line)
throws MalformedHeaderException
public static void main(java.lang.String[] argv)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||