Package org.apache.james.mime4j.internal
Class ParserStreamContentHandler
java.lang.Object
org.apache.james.mime4j.internal.ParserStreamContentHandler
- All Implemented Interfaces:
ContentHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BodyFactory
private final Entity
private final MessageImplFactory
-
Constructor Summary
ConstructorsConstructorDescriptionParserStreamContentHandler
(Entity entity, BodyFactory bodyFactory) ParserStreamContentHandler
(Entity entity, MessageImplFactory messageImplFactory, BodyFactory bodyFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
body
(BodyDescriptor bd, InputStream is) Called when the body of a discrete (non-multipart) entity is about to be parsed.void
Called when a body part ends.void
Called when there are no more header fields in a message or body part.void
Called when a message ends.void
Called when the body of an entity has been parsed.void
epilogue
(InputStream is) Called for the epilogue (whatever comes after the final body part) of amultipart/*
entity.private void
void
Called for each field of a header.private static ByteSequence
void
preamble
(InputStream is) Called for the preamble (whatever comes before the first body part) of amultipart/*
entity.void
raw
(InputStream is) Unsupported.void
Called when a new body part starts inside amultipart/*
entity.void
Called when a header (of a message or body part) is about to be parsed.void
Called when a new message starts (a top level message or an embedded rfc822 message).void
Called when the body of a multipart entity is about to be parsed.
-
Field Details
-
entity
-
messageImplFactory
-
bodyFactory
-
stack
-
-
Constructor Details
-
ParserStreamContentHandler
-
ParserStreamContentHandler
public ParserStreamContentHandler(Entity entity, MessageImplFactory messageImplFactory, BodyFactory bodyFactory)
-
-
Method Details
-
expect
-
startMessage
Description copied from interface:ContentHandler
Called when a new message starts (a top level message or an embedded rfc822 message).- Specified by:
startMessage
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
endMessage
Description copied from interface:ContentHandler
Called when a message ends.- Specified by:
endMessage
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
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 interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
field
Description copied from interface:ContentHandler
Called for each field of a header.- Specified by:
field
in interfaceContentHandler
- Parameters:
field
- the MIME field.- Throws:
MimeException
- on processing errors
-
endHeader
Description copied from interface:ContentHandler
Called when there are no more header fields in a message or body part.- Specified by:
endHeader
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
startMultipart
Description copied from interface:ContentHandler
Called when the body of a multipart entity is about to be parsed.- Specified by:
startMultipart
in 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-Type
andContent-Transfer-Encoding
header fields.- Throws:
MimeException
- on processing errors
-
body
Description copied from interface:ContentHandler
Called when the body of a discrete (non-multipart) entity is about to be parsed.- Specified by:
body
in 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. Thebd
parameter should be used to determine how the stream data should be decoded.- Throws:
MimeException
- on processing errorsIOException
- should be thrown on I/O errors.
-
endMultipart
Description copied from interface:ContentHandler
Called when the body of an entity has been parsed.- Specified by:
endMultipart
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
startBodyPart
Description copied from interface:ContentHandler
Called when a new body part starts inside amultipart/*
entity.- Specified by:
startBodyPart
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
endBodyPart
Description copied from interface:ContentHandler
Called when a body part ends.- Specified by:
endBodyPart
in interfaceContentHandler
- Throws:
MimeException
- on processing errors
-
epilogue
Description copied from interface:ContentHandler
Called for the epilogue (whatever comes after the final body part) of amultipart/*
entity.- Specified by:
epilogue
in interfaceContentHandler
- Parameters:
is
- used to get the contents of the epilogue.- Throws:
MimeException
- on processing errorsIOException
- should be thrown on I/O errors.
-
preamble
Description copied from interface:ContentHandler
Called for the preamble (whatever comes before the first body part) of amultipart/*
entity.- Specified by:
preamble
in interfaceContentHandler
- Parameters:
is
- used to get the contents of the preamble.- Throws:
MimeException
- on processing errorsIOException
- should be thrown on I/O errors.
-
raw
Unsupported.- Specified by:
raw
in interfaceContentHandler
- Parameters:
is
- the raw contents of the entity.- Throws:
UnsupportedOperationException
MimeException
- on processing errorsIOException
- should be thrown on I/O errors.- See Also:
-
loadStream
- Throws:
IOException
-