|
SonicMQ API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Part
The Part is a part of a MultipartMessage. Each part has an associated Header and Content.
The Header contains header fields, such as Content-Type and Content-Id.
The content of the part is accessed through a javax.activation.DataHandler
.
The "content" of a part is available in various formats:
getDataHandler()
method. The "content" of a Part is also
available through a javax.activation.DataHandler
object. The DataHandler object allows
clients to discover the operations available on the content, and to instantiate the appropriate
component to perform those operations.
getInputStream()
method.
getContent()
method. This method returns the "content"
as a Java object. The returned object is of course dependent on the content itself.
Method Summary | |
---|---|
java.lang.Object |
getContent()
Gets the content of the part as an Object. |
byte[] |
getContentBytes()
Gets the content of the part as a byte array. |
javax.activation.DataHandler |
getDataHandler()
This method provides the mechanism to get this part's content. |
Header |
getHeader()
Gets the Header for the Part. |
java.io.InputStream |
getInputStream()
Return an input stream for this part's "content". |
java.io.OutputStream |
getOutputStream()
Return an output stream for writing this part's "content". |
boolean |
isMessagePart()
|
void |
setContent(byte[] content)
A convenience method for setting this part's content. |
void |
setContent(java.lang.Object object,
java.lang.String type)
A convenience method for setting this part's content. |
void |
setDataHandler(javax.activation.DataHandler dataHandler)
This method provides the mechanism to set this part's content. |
Method Detail |
---|
Header getHeader()
JMSException
- If operation failed due to some internal error.javax.activation.DataHandler getDataHandler() throws JMSException
JMSException
- If operation failed due to some internal error.void setDataHandler(javax.activation.DataHandler dataHandler) throws JMSException
dataHandler
- The DataHandler.
JMSException
- If operation failed due to some internal error.
MessageNotWriteableException
- If message is in read-only mode.java.io.InputStream getInputStream() throws JMSException
This is a convenience method that just invokes the DataHandler's getInputStream() method.
java.io.IOException
- this is typically thrown by the DataHandler. Refer to the documentation for javax.activation.DataHandler
for more details.
JMSException
- If operation failed due to some internal error.java.io.OutputStream getOutputStream() throws JMSException
This is typically a convenience method that just invokes the DataHandler's getOuputStream() method. &return An InputStream.
This is a convenience method that just invokes the DataHandler's getInputStream() method.
java.io.IOException
- this is typically thrown by the DataHandler. Refer to the documentation for javax.activation.DataHandler
for more details.
JMSException
- If operation failed due to some internal error.java.lang.Object getContent()
byte[] getContentBytes()
void setContent(java.lang.Object object, java.lang.String type) throws JMSException
Note that a DataContentHandler class for the specified type should be available for this to work right.
i.e., to do setContent(mycontents, "application/x-mytype")
, a DataContentHandler for "application/x-mytype" should be installed.
Refer to the Java Activation Framework for more information.
object
- A Java Object.type
- The Content-Type of this object
JMSException
- If operation failed due to some internal error.
MessageNotWriteableException
- If message is in read-only mode.void setContent(byte[] content) throws JMSException
content
- The byte array of content to be set.
JMSException
- If operation failed due to some internal error.
MessageNotWriteableException
- If message is in read-only mode.boolean isMessagePart()
|
SonicMQ API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |