All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.www.mime.MimeHeaders

java.lang.Object
   |
   +----w3c.www.mime.MimeHeaders

public class MimeHeaders
extends Object
implements MimeHeaderHolder
The most stupid MIME header holder. This class uses a hashtable mapping header names (as String), to header values (as String). Header names are lowered before entering the hashtable.


Constructor Index

 o MimeHeaders()
 o MimeHeaders(MimeParser)

Method Index

 o dump(PrintStream)
Dump all headers to the given stream.
 o enumerateHeaders()
Enumerate the headers defined by the holder.
 o getInputStream()
Get the entity stream attached to these headers, if any.
 o getValue(String)
Retreive a header value.
 o notifyBeginParsing(MimeParser)
The parsing is now about to start, take any appropriate action.
 o notifyEndParsing(MimeParser)
All the headers have been parsed, take any appropriate actions.
 o notifyHeader(String, byte[], int, int)
A new header has been parsed.
 o setValue(String, String)
Set a header value.

Constructors

 o MimeHeaders
 public MimeHeaders(MimeParser parser)
 o MimeHeaders
 public MimeHeaders()

Methods

 o notifyHeader
 public void notifyHeader(String name,
                          byte buf[],
                          int off,
                          int len) throws MimeParserException
A new header has been parsed.

Parameters:
name - The name of the encountered header.
buf - The byte buffer containing the value.
off - Offset of the header value in the above buffer.
len - Length of the value in the above header.
 o notifyBeginParsing
 public boolean notifyBeginParsing(MimeParser parser) throws IOException
The parsing is now about to start, take any appropriate action. This hook can return a true boolean value to enforce the MIME parser into transparent mode (eg the parser will not try to parse any headers.

This hack is primarily defined for HTTP/0.9 support, it might also be usefull for other hacks.

Parameters:
parser - The Mime parser.
Returns:
A boolean true if the MimeParser shouldn't continue the parsing, false otherwise.
 o notifyEndParsing
 public void notifyEndParsing(MimeParser parser) throws IOException
All the headers have been parsed, take any appropriate actions.

Parameters:
parser - The Mime parser.
 o setValue
 public void setValue(String name,
                      String value)
Set a header value.

Parameters:
name - The header name.
value - The header value.
 o getValue
 public String getValue(String name)
Retreive a header value.

Parameters:
name - The name of the header.
Returns:
The value for this header, or null if undefined.
 o enumerateHeaders
 public Enumeration enumerateHeaders()
Enumerate the headers defined by the holder.

Returns:
A enumeration of header names, or null if no header is defined.
 o getInputStream
 public InputStream getInputStream()
Get the entity stream attached to these headers, if any.

Returns:
An InputStream instance, or null if no entity available.
 o dump
 public void dump(PrintStream out)
Dump all headers to the given stream.

Parameters:
out - The stream to dump to.

All Packages  Class Hierarchy  This Package  Previous  Next  Index