|
Vordel SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vordel.mime.Body
public abstract class Body
Represents a MIME body.
Bodies are generally constructed from a ContentType
and an InputStream
, via create(com.vordel.mime.HeaderSet, com.vordel.mime.ContentType, com.vordel.dwe.ContentSource)
Specific subclasses may be constructed directly.
BodyFactory objects can register their interest in subclassing specific
content types (see registerFactory(java.lang.String, com.vordel.mime.BodyFactory)
)
Field Summary | |
---|---|
static int |
CAN_INVALIDATE
Flags for write: |
protected ContentType |
contentType
|
static ContentType |
CT_APP_OCTET_STREAM
|
static ContentType |
CT_DEFAULT
|
static ContentType |
CT_MULTIPART_RELATED
|
static ContentType |
CT_TEXT_PLAIN
|
static ContentType |
CT_TEXT_XML_UTF8
|
static ContentType |
CT_XOP_APPLICATION_XML
|
protected HeaderSet |
headers
|
static int |
PUSH_WRITE
|
static int |
REMOVE_XFER_ENCODING_ON_WRITE
|
static int |
RETAIN_XFER_ENCODING_ON_READ
|
Constructor Summary | |
---|---|
protected |
Body(HeaderSet headers,
ContentType contentType)
Base constructor for body. |
Method Summary | |
---|---|
void |
bufferInput()
|
abstract boolean |
contentAvailable()
|
static Body |
create(HeaderSet headers,
ContentType ct,
com.vordel.dwe.ContentSource source)
Construct a subclass of body from a set of headers, a content type, and an InputStream. |
void |
dispose()
|
static void |
fini()
|
java.lang.String |
getContentEncoding()
Return content encoding. |
java.lang.String |
getContentId()
Get the Content Id for this body. |
long |
getContentLength(int flags)
Return the Content length of the body. |
ContentType |
getContentType()
Get the ContentType for this body. |
HeaderSet |
getHeaders()
Get the MIME headers for this body. |
java.io.InputStream |
getInputStream(int flags)
|
CompoundBody |
getParent()
Get the parent Body. |
com.vordel.dwe.ContentSource |
getSource()
Get a ContentSource that can be used as a factory for InputStream's from which to read the original message content. |
void |
initSource(com.vordel.dwe.ContentSource source,
java.lang.String encoding)
|
void |
parse()
If necessary, read the InputStream source for a body to "parse" it. |
protected abstract void |
parse(java.io.InputStream is)
Parse a body from a specific InputStream. |
protected abstract void |
purgeContent()
Bodies are purged() when they are no longer in use. |
static void |
registerFactory(java.lang.String pattern,
BodyFactory factory)
Register a handler for a set of content types. |
protected void |
setParent(CompoundBody parent)
|
void |
write(java.io.OutputStream os,
int flags)
Write the content of this Body (not including its headers) to an OutputStream. |
abstract void |
writeContent(java.io.OutputStream os,
int flags)
Write the content of the body to the specified OutputStream This is similar to write(java.io.OutputStream, int) , but does not include the
headers for the body. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ContentType CT_DEFAULT
public static final ContentType CT_TEXT_PLAIN
public static final ContentType CT_APP_OCTET_STREAM
public static final ContentType CT_MULTIPART_RELATED
public static final ContentType CT_XOP_APPLICATION_XML
public static final ContentType CT_TEXT_XML_UTF8
protected final ContentType contentType
protected final HeaderSet headers
public static final int CAN_INVALIDATE
public static final int PUSH_WRITE
public static final int REMOVE_XFER_ENCODING_ON_WRITE
public static final int RETAIN_XFER_ENCODING_ON_READ
Constructor Detail |
---|
protected Body(HeaderSet headers, ContentType contentType)
headers
- the headers for the content of this body.contentType
- The MIME content type for this body.Method Detail |
---|
public abstract boolean contentAvailable()
public void bufferInput() throws java.io.IOException
java.io.IOException
public com.vordel.dwe.ContentSource getSource()
public java.io.InputStream getInputStream(int flags) throws java.io.IOException
java.io.IOException
public CompoundBody getParent()
public HeaderSet getHeaders()
public ContentType getContentType()
public java.lang.String getContentId()
public long getContentLength(int flags) throws java.io.IOException
Note that as the flags sent to the write(java.io.OutputStream, int)
method may
affect the output, this method must be passed the same flags.
java.io.IOException
protected void setParent(CompoundBody parent)
public static void registerFactory(java.lang.String pattern, BodyFactory factory)
public static void fini()
public static Body create(HeaderSet headers, ContentType ct, com.vordel.dwe.ContentSource source)
Note that the InputStream will not be read until the body is parse()
d
protected abstract void parse(java.io.InputStream is) throws java.io.IOException
This should be considered "private" to callers:
it must be invoked via
parse()
java.io.IOException
parse()
public final void parse() throws java.io.IOException
java.io.IOException
public void initSource(com.vordel.dwe.ContentSource source, java.lang.String encoding)
public java.lang.String getContentEncoding()
public final void write(java.io.OutputStream os, int flags) throws java.io.IOException
os
- The OutputStream to write toflags
- A bitwise OR of the following flags.
java.io.IOException
public abstract void writeContent(java.io.OutputStream os, int flags) throws java.io.IOException
write(java.io.OutputStream, int)
, but does not include the
headers for the body.
java.io.IOException
#wrote
protected abstract void purgeContent()
public final void dispose()
dispose
in interface com.vordel.system.Disposable
|
Vordel SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |