public class ParserStreamContentHandler extends java.lang.Object implements ContentHandler
| Modifier and Type | Field and Description |
|---|---|
private BodyFactory |
bodyFactory |
private Entity |
entity |
private MessageImplFactory |
messageImplFactory |
private java.util.Stack<java.lang.Object> |
stack |
| Constructor and Description |
|---|
ParserStreamContentHandler(Entity entity,
BodyFactory bodyFactory) |
ParserStreamContentHandler(Entity entity,
MessageImplFactory messageImplFactory,
BodyFactory bodyFactory) |
| Modifier and Type | Method and Description |
|---|---|
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. |
private void |
expect(java.lang.Class<?> c) |
void |
field(Field field)
Called for each field of a header.
|
private static ByteSequence |
loadStream(java.io.InputStream in) |
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)
Unsupported.
|
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.
|
private final Entity entity
private final MessageImplFactory messageImplFactory
private final BodyFactory bodyFactory
private final java.util.Stack<java.lang.Object> stack
public ParserStreamContentHandler(Entity entity, BodyFactory bodyFactory)
public ParserStreamContentHandler(Entity entity, MessageImplFactory messageImplFactory, BodyFactory bodyFactory)
private void expect(java.lang.Class<?> c)
public void startMessage()
throws MimeException
ContentHandlerstartMessage in interface ContentHandlerMimeException - on processing errorspublic void endMessage()
throws MimeException
ContentHandlerendMessage in interface ContentHandlerMimeException - on processing errorspublic void startHeader()
throws MimeException
ContentHandlerstartHeader in interface ContentHandlerMimeException - on processing errorspublic void field(Field field) throws MimeException
ContentHandlerfield in interface ContentHandlerfield - the MIME field.MimeException - on processing errorspublic void endHeader()
throws MimeException
ContentHandlerendHeader in interface ContentHandlerMimeException - on processing errorspublic void startMultipart(BodyDescriptor bd) throws MimeException
ContentHandlerstartMultipart in interface ContentHandlerbd - 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.MimeException - on processing errorspublic void body(BodyDescriptor bd, java.io.InputStream is) throws MimeException, java.io.IOException
ContentHandlerbody in interface ContentHandlerbd - 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.MimeException - on processing errorsjava.io.IOException - should be thrown on I/O errors.public void endMultipart()
throws MimeException
ContentHandlerendMultipart in interface ContentHandlerMimeException - on processing errorspublic void startBodyPart()
throws MimeException
ContentHandlermultipart/* entity.startBodyPart in interface ContentHandlerMimeException - on processing errorspublic void endBodyPart()
throws MimeException
ContentHandlerendBodyPart in interface ContentHandlerMimeException - on processing errorspublic void epilogue(java.io.InputStream is)
throws MimeException,
java.io.IOException
ContentHandlermultipart/* entity.epilogue in interface ContentHandleris - used to get the contents of the epilogue.MimeException - on processing errorsjava.io.IOException - should be thrown on I/O errors.public void preamble(java.io.InputStream is)
throws MimeException,
java.io.IOException
ContentHandlermultipart/* entity.preamble in interface ContentHandleris - used to get the contents of the preamble.MimeException - on processing errorsjava.io.IOException - should be thrown on I/O errors.public void raw(java.io.InputStream is)
throws MimeException,
java.io.IOException
raw in interface ContentHandleris - the raw contents of the entity.java.lang.UnsupportedOperationExceptionMimeException - on processing errorsjava.io.IOException - should be thrown on I/O errors.MimeStreamParser.setRaw()private static ByteSequence loadStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException