## org.w3c.www.mime
Class MimeHeaders

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

public class MimeHeaders
extends java.lang.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 Summary
`MimeHeaders()`
`MimeHeaders(MimeParser parser)`

Method Summary
`void` | `dump(java.io.PrintStream out)` Dump all headers to the given stream.
`java.util.Enumeration` | `enumerateHeaders()` Enumerate the headers defined by the holder.
`java.io.InputStream` | `getInputStream()` Get the entity stream attached to these headers, if any.
`java.lang.String` | `getValue(java.lang.String name)` Retreive a header value.
`boolean` | `notifyBeginParsing(MimeParser parser)` The parsing is now about to start, take any appropriate action.
`void` | `notifyEndParsing(MimeParser parser)` All the headers have been parsed, take any appropriate actions.
`void` | `notifyHeader(java.lang.String name, byte[] buf, int off, int len)` A new header has been parsed.
`void` | `setValue(java.lang.String name, java.lang.String value)` Set a header value.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MimeHeaders

    public MimeHeaders(MimeParser parser)

### MimeHeaders

    public MimeHeaders()

Method Detail

### notifyHeader

    public void notifyHeader(java.lang.String name,
                             byte[] buf,
                             int off,
                             int len)
                      throws MimeParserException

  A new header has been parsed.
  Specified by:
    notifyHeader in interface MimeHeaderHolder
  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.
  Throws:
    MimeParserException - if the parsing failed

### notifyBeginParsing

    public boolean notifyBeginParsing(MimeParser parser)
                               throws java.io.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.

  Specified by:
    notifyBeginParsing in interface MimeHeaderHolder
  Parameters:
    `parser` - The Mime parser.
  Returns:
    A boolean true if the MimeParser shouldn't continue the parsing, false otherwise.
  Throws:
    java.io.IOException - if an IO error occurs.

### notifyEndParsing

    public void notifyEndParsing(MimeParser parser)
                          throws java.io.IOException

  All the headers have been parsed, take any appropriate actions.
  Specified by:
    notifyEndParsing in interface MimeHeaderHolder
  Parameters:
    `parser` - The Mime parser.
  Throws:
    java.io.IOException - if an IO error occurs.

### setValue

    public void setValue(java.lang.String name,
                         java.lang.String value)

  Set a header value.
  Parameters:
    `name` - The header name.
    `value` - The header value.

### getValue

    public java.lang.String getValue(java.lang.String name)

  Retreive a header value.
  Parameters:
    `name` - The name of the header.
  Returns:
    The value for this header, or null if undefined.

### enumerateHeaders

    public java.util.Enumeration enumerateHeaders()

  Enumerate the headers defined by the holder.
  Returns:
    A enumeration of header names, or null if no header is defined.

### getInputStream

    public java.io.InputStream getInputStream()

  Get the entity stream attached to these headers, if any.
  Returns:
    An InputStream instance, or null if no entity available.

### dump

    public void dump(java.io.PrintStream out)

  Dump all headers to the given stream.
  Parameters:
    `out` - The stream to dump to.