|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.mime.HeaderedEntity
ccs.mime.MimeEntity
public class MimeEntity
The HeaderedEntity finds multiple uses in simple MIME or MIME-like applications
(e.g. HTTP, which is similar to MIME but is nevertheless not MIME conformant.)
However, it does not support the MIME feature whereby MIME entities may be nested
inside other MIME entities, potentially forming an arbitrary tree. This does. It
does not supplant other constructs; specifically there remain situations where it's
preferable to use a basic HeaderedEntity or simpler constructs, e.g.
MUtil.rawMultipartSet
. MT-UNSAFE.
Before any API on this can be used, the body must have been read in, as a RepeatingSwappingBuffer. (This constraint avoids consistency issues when the body is or is not composite).
Known quirk: The preamble and epilogue buffers frequently pick up a superfluous
CRLF pair after whatever is actually supposed to be there (this is an artifact of
the way the line-parsing mechanism copes with MIME boundary strings). The MIME
definition has little to say about these areas, so applications which care about
them need to have parsers which are tolerant of this (and more). This trailer will
be automatically stripped off when (if) compileBody
is invoked, so
don't do it yourself.
Note that due to permitted formatting variations for MIME headers, a
parseBody
-then-compileBody
round trip is not always
an identity transformation. (So, for example, only do crypto on the original
body).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ccs.mime.HeaderedEntity |
---|
HeaderedEntity.UnmarshalModes |
Field Summary | |
---|---|
RepeatingSwappingBuffer |
epilogue
If composite, the epilogue between the end of the last part and EOF. |
RepeatingSwappingBuffer |
preamble
If composite, the preamble to the set. |
MimeEntity[] |
subparts
If composite, the subparts contained within this. else null. |
Constructor Summary | |
---|---|
MimeEntity()
Create a MimeEntity with collapsing headers. |
|
MimeEntity(boolean isCollapse)
Create a MimeEntity. |
Method Summary | |
---|---|
void |
cleanupRepeatableBody()
Recursively clean up the body, preamble, epilogue and any subparts. |
void |
compileBody()
If composite, recursively reassemble the message body from its subparts. |
boolean |
isComposite()
Whether this entity is composite, i.e. it contains other entities. |
void |
parseBody()
If composite, analyse the body into subparts, recursively. |
Methods inherited from class ccs.mime.HeaderedEntity |
---|
addHeader, addHeader, bodySize, deleteHeader, deleteHeader, getBody, getBodyBytes, getBodyHasTrailer, getHeader, getHeaderIndex, getHeaderInt, getHeaderNames, getName, getValue, getWireLength, isBoundary, marshalTo, nHeaders, out, readBodyFrom, readBodyFrom, readFrom, readHeadersFrom, readRepeatableBodyFrom, readRepeatableBodyFrom, readRepeatableFrom, setBody, setBodyHasTrailer, setHeader, setHeader, swallowPreamble, unmarshalFrom, wasLastBoundary, writeBodyTo, writeHeadersTo, writeln |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public RepeatingSwappingBuffer preamble
public RepeatingSwappingBuffer epilogue
public MimeEntity[] subparts
Constructor Detail |
---|
public MimeEntity()
public MimeEntity(boolean isCollapse)
isCollapse
- Whether to collapse headers which have the same name.Method Detail |
---|
public boolean isComposite()
public void parseBody() throws java.io.IOException
java.io.IOException
public void compileBody() throws java.io.IOException
java.io.IOException
public void cleanupRepeatableBody() throws java.io.IOException
cleanupRepeatableBody
in class HeaderedEntity
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |