## org.w3c.www.mime
Class MimeParser

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

public class MimeParser
extends java.lang.Object

The MimeParser class parses an input MIME stream.

Field Summary
`protected int` `bsize`
`protected byte[]` `buffer`
`protected int` `ch`
`protected MimeParserFactory` `factory` The factory used to create new MIME header holders.
`protected java.io.InputStream` `input`

Constructor Summary
`MimeParser(java.io.InputStream input, MimeParserFactory factory)` Create an instance of the MIMEParser class.

Method Summary
`protected void` `append(int c)`
`protected void` `expect(int car)`
`java.io.InputStream` `getInputStream()` Get the message body, as an input stream.
`static void` `main(java.lang.String[] args)` Debuging
`MimeHeaderHolder` `parse()` parse the stream, and create a MimeHeaderHolder containing all the parsed headers, in lenient mode Always be lenient by default (general rule is: be lenient in what you accept conservative with what you generate).
`MimeHeaderHolder` `parse(boolean lenient)` parse the stream, and create a MimeHeaderHolder containing all the parsed headers, note that invalid headers will trigger an exception in stirct mode, and will just be removed in lenient mode
`protected void` `parse822HeaderBody()`
`protected void` `parse822HeaderBody(boolean lenient)`
`protected void` `parse822HeaderBodyLenient()`
`protected void` `parse822HeaderBodyStrict()`
`protected java.lang.String` `parse822HeaderName()`
`protected void` `parse822Headers(MimeHeaderHolder msg)`
`protected void` `parse822Headers(MimeHeaderHolder msg, boolean lenient)`
`protected java.lang.String` `parseToken(boolean lower)`
`int` `read()`
`protected void` `skipSpaces()`
`void` `unread(int ch)`

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

Field Detail

### ch

    protected int ch

### input

    protected java.io.InputStream input

### buffer

    protected byte[] buffer

### bsize

    protected int bsize

### factory

    protected MimeParserFactory factory

  The factory used to create new MIME header holders.

Constructor Detail

### MimeParser

    public MimeParser(java.io.InputStream input,
                      MimeParserFactory factory)

  Create an instance of the MIMEParser class.
  Parameters:
    `in` - The input stream to be parsed as a MIME stream.
    `factory` - The factory used to create MIME header holders.

Method Detail

### expect

    protected void expect(int car)
                   throws MimeParserException,
                          java.io.IOException

### skipSpaces

    protected void skipSpaces()
                       throws MimeParserException,
                              java.io.IOException

### append

    protected final void append(int c)

### parse822HeaderName

    protected java.lang.String parse822HeaderName()
                                           throws MimeParserException,
                                                  java.io.IOException

### parse822HeaderBody

    protected void parse822HeaderBody()
                               throws MimeParserException,
                                      java.io.IOException

### parse822HeaderBodyLenient

    protected void parse822HeaderBodyLenient()
                                      throws MimeParserException,
                                             java.io.IOException

### parse822HeaderBody

    protected void parse822HeaderBody(boolean lenient)
                               throws MimeParserException,
                                      java.io.IOException

### parse822HeaderBodyStrict

    protected void parse822HeaderBodyStrict()
                                     throws MimeParserException,
                                            java.io.IOException

### parseToken

    protected java.lang.String parseToken(boolean lower)
                                   throws MimeParserException,
                                          java.io.IOException

### parse822Headers

    protected void parse822Headers(MimeHeaderHolder msg,
                                   boolean lenient)
                            throws MimeParserException,
                                   java.io.IOException

### parse822Headers

    protected void parse822Headers(MimeHeaderHolder msg)
                            throws MimeParserException,
                                   java.io.IOException

### parse

    public MimeHeaderHolder parse(boolean lenient)
                           throws MimeParserException,
                                  java.io.IOException

  parse the stream, and create a MimeHeaderHolder containing all the parsed headers, note that invalid headers will trigger an exception in stirct mode, and will just be removed in lenient mode
  Parameters:
    `lenient,` - a boolean, true if we want to be kind with bad people
  Returns:
    a MimeHeaderHolder instance containing the aprsed headers

### parse

    public MimeHeaderHolder parse()
                           throws MimeParserException,
                                  java.io.IOException

  parse the stream, and create a MimeHeaderHolder containing all the parsed headers, in lenient mode Always be lenient by default (general rule is: be lenient in what you accept conservative with what you generate).

### read

    public int read()
             throws java.io.IOException

### unread

    public void unread(int ch)

### getInputStream

    public java.io.InputStream getInputStream()

  Get the message body, as an input stream.
  Returns:
    The input stream used by the parser to get data, after a call to `parse`, this input stream contains exactly the body of the message.

### main

    public static void main(java.lang.String[] args)

  Debuging