Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.james.mime4j.message
Class SimpleContentHandler

    java.lang.Object
      org.apache.james.mime4j.parser.AbstractContentHandler
          org.apache.james.mime4j.message.SimpleContentHandler

All Implemented Interfaces:
  ContentHandler

    public abstract class SimpleContentHandler

extends AbstractContentHandler

Abstract implementation of ContentHandler that automates common tasks. Currently performs header parsing and applies content-transfer decoding to body parts.

Constructor Summary
`SimpleContentHandler()`

Method Summary
`void` | `body(BodyDescriptor bd, java.io.InputStream is)` Called when the body of a discrete (non-multipart) entity is about to be parsed.
`abstract void` | `bodyDecoded(BodyDescriptor bd, java.io.InputStream is)` Called when the body of a discrete (non-multipart) entity is encountered.
`void` | `endHeader()` Called when there are no more header fields in a message or body part.
`void` | `field(java.lang.String fieldData)` Called for each field of a header.
`abstract void` | `headers(Header header)` Called after headers are parsed.
`void` | `startHeader()` Called when a header (of a message or body part) is about to be parsed.

Methods inherited from class org.apache.james.mime4j.parser.AbstractContentHandler
`endBodyPart, endMessage, endMultipart, epilogue, preamble, raw, startBodyPart, startMessage, startMultipart`

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

Constructor Detail

### SimpleContentHandler

    public SimpleContentHandler()

Method Detail

### headers

    public abstract void headers(Header header)

  Called after headers are parsed.

### bodyDecoded

    public abstract void bodyDecoded(BodyDescriptor bd,
                                     java.io.InputStream is)
                              throws java.io.IOException

  Called when the body of a discrete (non-multipart) entity is encountered.

  Parameters:
    `bd` - encapsulates the values (either read from the message stream or, if not present, determined implictly as described in the MIME rfc:s) of the `Content-Type` and `Content-Transfer-Encoding` header fields.
    `is` - the contents of the body. Base64 or quoted-printable decoding will be applied transparently.
  Throws:
    `java.io.IOException` - should be thrown on I/O errors.

### startHeader

    public final void startHeader()

  Description copied from interface: `ContentHandler`
  Called when a header (of a message or body part) is about to be parsed.

  Specified by:
    `startHeader` in interface `ContentHandler`
  Overrides:
    `startHeader` in class `AbstractContentHandler`
  See Also:
    `AbstractContentHandler.startHeader()`

### field

    public final void field(java.lang.String fieldData)
                     throws MimeException

  Description copied from interface: `ContentHandler`
  Called for each field of a header.

  Specified by:
    `field` in interface `ContentHandler`
  Overrides:
    `field` in class `AbstractContentHandler`
  Parameters:
    `fieldData` - the raw contents of the field (`Field-Name: field value`). The value will not be unfolded.
  Throws:
    `MimeException` - on processing errors
  See Also:
    `AbstractContentHandler.field(java.lang.String)`

### endHeader

    public final void endHeader()

  Description copied from interface: `ContentHandler`
  Called when there are no more header fields in a message or body part.

  Specified by:
    `endHeader` in interface `ContentHandler`
  Overrides:
    `endHeader` in class `AbstractContentHandler`
  See Also:
    `AbstractContentHandler.endHeader()`

### body

    public final void body(BodyDescriptor bd,
                           java.io.InputStream is)
                    throws java.io.IOException

  Description copied from interface: `ContentHandler`
  Called when the body of a discrete (non-multipart) entity is about to be parsed.

  Specified by:
    `body` in interface `ContentHandler`
  Overrides:
    `body` in class `AbstractContentHandler`
  Parameters:
    `bd` - see `ContentHandler.startMultipart(BodyDescriptor)`
    `is` - the contents of the body. NOTE: this is the raw body contents - it will not be decoded if encoded. The `bd` parameter should be used to determine how the stream data should be decoded.
  Throws:
    `MimeException` - on processing errors
    `java.io.IOException` - should be thrown on I/O errors.
  See Also:
    `AbstractContentHandler.body(org.apache.james.mime4j.descriptor.BodyDescriptor, java.io.InputStream)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.