org.apache.james.mime4j.parser
Class AbstractContentHandler

java.lang.Object
  extended by org.apache.james.mime4j.parser.AbstractContentHandler
All Implemented Interfaces:
ContentHandler
Direct Known Subclasses:
SimpleContentHandler

public abstract class AbstractContentHandler
extends java.lang.Object
implements ContentHandler

Abstract ContentHandler with default implementations of all the methods of the ContentHandler interface. The default is to todo nothing.

Version:
$Id: AbstractContentHandler.java,v 1.3 2004/10/02 12:41:10 ntherning Exp $

Constructor Summary
AbstractContentHandler()
           
 
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.
 void endBodyPart()
          Called when a body part ends.
 void endHeader()
          Called when there are no more header fields in a message or body part.
 void endMessage()
          Called when a message ends.
 void endMultipart()
          Called when the body of an entity has been parsed.
 void epilogue(java.io.InputStream is)
          Called for the epilogue (whatever comes after the final body part) of a multipart/* entity.
 void field(java.lang.String fieldData)
          Called for each field of a header.
 void preamble(java.io.InputStream is)
          Called for the preamble (whatever comes before the first body part) of a multipart/* entity.
 void raw(java.io.InputStream is)
          Called when a new entity (message or body part) starts and the parser is in raw mode.
 void startBodyPart()
          Called when a new body part starts inside a multipart/* entity.
 void startHeader()
          Called when a header (of a message or body part) is about to be parsed.
 void startMessage()
          Called when a new message starts (a top level message or an embedded rfc822 message).
 void startMultipart(BodyDescriptor bd)
          Called when the body of a multipart entity is about to be parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContentHandler

public AbstractContentHandler()
Method Detail

endMultipart

public void endMultipart()
                  throws MimeException
Description copied from interface: ContentHandler
Called when the body of an entity has been parsed.

Specified by:
endMultipart in interface ContentHandler
Throws:
MimeException - on processing errors
See Also:
ContentHandler.endMultipart()

startMultipart

public void startMultipart(BodyDescriptor bd)
                    throws MimeException
Description copied from interface: ContentHandler
Called when the body of a multipart entity is about to be parsed.

Specified by:
startMultipart in interface ContentHandler
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.
Throws:
MimeException - on processing errors
See Also:
ContentHandler.startMultipart(org.apache.james.mime4j.descriptor.BodyDescriptor)

body

public void body(BodyDescriptor bd,
                 java.io.InputStream is)
          throws MimeException,
                 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
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:
ContentHandler.body(org.apache.james.mime4j.descriptor.BodyDescriptor, java.io.InputStream)

endBodyPart

public void endBodyPart()
                 throws MimeException
Description copied from interface: ContentHandler
Called when a body part ends.

Specified by:
endBodyPart in interface ContentHandler
Throws:
MimeException - on processing errors
See Also:
ContentHandler.endBodyPart()

endHeader

public void endHeader()
               throws MimeException
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
Throws:
MimeException - on processing errors
See Also:
ContentHandler.endHeader()

endMessage

public void endMessage()
                throws MimeException
Description copied from interface: ContentHandler
Called when a message ends.

Specified by:
endMessage in interface ContentHandler
Throws:
MimeException - on processing errors
See Also:
ContentHandler.endMessage()

epilogue

public void epilogue(java.io.InputStream is)
              throws MimeException,
                     java.io.IOException
Description copied from interface: ContentHandler
Called for the epilogue (whatever comes after the final body part) of a multipart/* entity.

Specified by:
epilogue in interface ContentHandler
Parameters:
is - used to get the contents of the epilogue.
Throws:
MimeException - on processing errors
java.io.IOException - should be thrown on I/O errors.
See Also:
ContentHandler.epilogue(java.io.InputStream)

field

public 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
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:
ContentHandler.field(java.lang.String)

preamble

public void preamble(java.io.InputStream is)
              throws MimeException,
                     java.io.IOException
Description copied from interface: ContentHandler
Called for the preamble (whatever comes before the first body part) of a multipart/* entity.

Specified by:
preamble in interface ContentHandler
Parameters:
is - used to get the contents of the preamble.
Throws:
MimeException - on processing errors
java.io.IOException - should be thrown on I/O errors.
See Also:
ContentHandler.preamble(java.io.InputStream)

startBodyPart

public void startBodyPart()
                   throws MimeException
Description copied from interface: ContentHandler
Called when a new body part starts inside a multipart/* entity.

Specified by:
startBodyPart in interface ContentHandler
Throws:
MimeException - on processing errors
See Also:
ContentHandler.startBodyPart()

startHeader

public void startHeader()
                 throws MimeException
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
Throws:
MimeException - on processing errors
See Also:
ContentHandler.startHeader()

startMessage

public void startMessage()
                  throws MimeException
Description copied from interface: ContentHandler
Called when a new message starts (a top level message or an embedded rfc822 message).

Specified by:
startMessage in interface ContentHandler
Throws:
MimeException - on processing errors
See Also:
ContentHandler.startMessage()

raw

public void raw(java.io.InputStream is)
         throws MimeException,
                java.io.IOException
Description copied from interface: ContentHandler
Called when a new entity (message or body part) starts and the parser is in raw mode.

Specified by:
raw in interface ContentHandler
Parameters:
is - the raw contents of the entity.
Throws:
MimeException - on processing errors
java.io.IOException - should be thrown on I/O errors.
See Also:
ContentHandler.raw(java.io.InputStream)


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