FileDocCategorySizeDatePackage
SimpleContentHandler.javaAPI DocAndroid 1.5 API3817Wed May 06 22:42:46 BST 2009org.apache.james.mime4j

SimpleContentHandler

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.

Fields Summary
private org.apache.james.mime4j.message.Header
currHeader
Constructors Summary
Methods Summary
public final voidbody(BodyDescriptor bd, java.io.InputStream is)

see
org.apache.james.mime4j.AbstractContentHandler#body(org.apache.james.mime4j.BodyDescriptor, java.io.InputStream)

        if (bd.isBase64Encoded()) {
            bodyDecoded(bd, new Base64InputStream(is));
        }
        else if (bd.isQuotedPrintableEncoded()) {
            bodyDecoded(bd, new QuotedPrintableInputStream(is));
        }
        else {
            bodyDecoded(bd, is);
        }
    
public abstract voidbodyDecoded(BodyDescriptor bd, java.io.InputStream is)
Called when the body of a discrete (non-multipart) entity is encountered.

param
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.
param
is the contents of the body. Base64 or quoted-printable decoding will be applied transparently.
throws
IOException should be thrown on I/O errors.

public final voidendHeader()

see
org.apache.james.mime4j.AbstractContentHandler#endHeader()

        Header tmp = currHeader;
        currHeader = null;
        headers(tmp);
    
public final voidfield(java.lang.String fieldData)

see
org.apache.james.mime4j.AbstractContentHandler#field(java.lang.String)

        currHeader.addField(Field.parse(fieldData));
    
public abstract voidheaders(org.apache.james.mime4j.message.Header header)
Called after headers are parsed.

public final voidstartHeader()

see
org.apache.james.mime4j.AbstractContentHandler#startHeader()

        currHeader = new Header();