Package org.apache.james.mime4j.parser
Class AbstractContentHandler
- java.lang.Object
-
- 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 base class for customContentHandlerimplementations. Methods of this class take no action and are expected to be selectively overridden by super-classes.
-
-
Constructor Summary
Constructors Constructor Description AbstractContentHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbody(BodyDescriptor bd, java.io.InputStream is)Called when the body of a discrete (non-multipart) entity is about to be parsed.voidendBodyPart()Called when a body part ends.voidendHeader()Called when there are no more header fields in a message or body part.voidendMessage()Called when a message ends.voidendMultipart()Called when the body of an entity has been parsed.voidepilogue(java.io.InputStream is)Called for the epilogue (whatever comes after the final body part) of amultipart/*entity.voidfield(Field field)Called for each field of a header.voidpreamble(java.io.InputStream is)Called for the preamble (whatever comes before the first body part) of amultipart/*entity.voidraw(java.io.InputStream is)Called when a new entity (message or body part) starts and the parser is inrawmode.voidstartBodyPart()Called when a new body part starts inside amultipart/*entity.voidstartHeader()Called when a header (of a message or body part) is about to be parsed.voidstartMessage()Called when a new message starts (a top level message or an embedded rfc822 message).voidstartMultipart(BodyDescriptor bd)Called when the body of a multipart entity is about to be parsed.
-
-
-
Method Detail
-
endMultipart
public void endMultipart() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when the body of an entity has been parsed.- Specified by:
endMultipartin interfaceContentHandler- Throws:
MimeException- on processing errors
-
startMultipart
public void startMultipart(BodyDescriptor bd) throws MimeException
Description copied from interface:ContentHandlerCalled when the body of a multipart entity is about to be parsed.- Specified by:
startMultipartin interfaceContentHandler- 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 theContent-TypeandContent-Transfer-Encodingheader fields.- Throws:
MimeException- on processing errors
-
body
public void body(BodyDescriptor bd, java.io.InputStream is) throws MimeException, java.io.IOException
Description copied from interface:ContentHandlerCalled when the body of a discrete (non-multipart) entity is about to be parsed.- Specified by:
bodyin interfaceContentHandler- Parameters:
bd- seeContentHandler.startMultipart(BodyDescriptor)is- the contents of the body. NOTE: this is the raw body contents - it will not be decoded if encoded. Thebdparameter should be used to determine how the stream data should be decoded.- Throws:
MimeException- on processing errorsjava.io.IOException- should be thrown on I/O errors.
-
endBodyPart
public void endBodyPart() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when a body part ends.- Specified by:
endBodyPartin interfaceContentHandler- Throws:
MimeException- on processing errors
-
endHeader
public void endHeader() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when there are no more header fields in a message or body part.- Specified by:
endHeaderin interfaceContentHandler- Throws:
MimeException- on processing errors
-
endMessage
public void endMessage() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when a message ends.- Specified by:
endMessagein interfaceContentHandler- Throws:
MimeException- on processing errors
-
epilogue
public void epilogue(java.io.InputStream is) throws MimeException, java.io.IOExceptionDescription copied from interface:ContentHandlerCalled for the epilogue (whatever comes after the final body part) of amultipart/*entity.- Specified by:
epiloguein interfaceContentHandler- Parameters:
is- used to get the contents of the epilogue.- Throws:
MimeException- on processing errorsjava.io.IOException- should be thrown on I/O errors.
-
field
public void field(Field field) throws MimeException
Description copied from interface:ContentHandlerCalled for each field of a header.- Specified by:
fieldin interfaceContentHandler- Parameters:
field- the MIME field.- Throws:
MimeException- on processing errors
-
preamble
public void preamble(java.io.InputStream is) throws MimeException, java.io.IOExceptionDescription copied from interface:ContentHandlerCalled for the preamble (whatever comes before the first body part) of amultipart/*entity.- Specified by:
preamblein interfaceContentHandler- Parameters:
is- used to get the contents of the preamble.- Throws:
MimeException- on processing errorsjava.io.IOException- should be thrown on I/O errors.
-
startBodyPart
public void startBodyPart() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when a new body part starts inside amultipart/*entity.- Specified by:
startBodyPartin interfaceContentHandler- Throws:
MimeException- on processing errors
-
startHeader
public void startHeader() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when a header (of a message or body part) is about to be parsed.- Specified by:
startHeaderin interfaceContentHandler- Throws:
MimeException- on processing errors
-
startMessage
public void startMessage() throws MimeExceptionDescription copied from interface:ContentHandlerCalled when a new message starts (a top level message or an embedded rfc822 message).- Specified by:
startMessagein interfaceContentHandler- Throws:
MimeException- on processing errors
-
raw
public void raw(java.io.InputStream is) throws MimeException, java.io.IOExceptionDescription copied from interface:ContentHandlerCalled when a new entity (message or body part) starts and the parser is inrawmode.- Specified by:
rawin interfaceContentHandler- Parameters:
is- the raw contents of the entity.- Throws:
MimeException- on processing errorsjava.io.IOException- should be thrown on I/O errors.- See Also:
MimeStreamParser.setRaw()
-
-