public class JAXBHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, XMLReadHandle, XMLWriteHandle
UNKNOWN_LENGTH| Constructor and Description |
|---|
JAXBHandle(JAXBContext context)
Initializes the JAXB handle with the JAXB context for the classes
of the marshalled or unmarshalled structure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromBuffer(byte[] buffer)
fromBuffer() unmarshals a JAXB POJO from a byte array
buffer.
|
Object |
get()
Returns the root object of the JAXB structure for the content.
|
void |
set(Object content)
Assigns the root object of the JAXB structure for the content.
|
void |
setFormat(Format format)
Restricts the format to XML.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
String |
toString()
Returns the JAXB structure as an XML string.
|
JAXBHandle |
with(Object content)
Assigns the root object of the JAXB structure for the content
and returns the handle as a fluent convenience.
|
JAXBHandle |
withMimetype(String mimetype)
Specifies the mime type of the content and returns the handle
as a fluent convenience.
|
void |
write(OutputStream out)
Implements a callback to write content to the provided output stream
for sending to the database server.
|
getByteLength, getFormat, getMimetype, setByteLength, setMimetypepublic JAXBHandle(JAXBContext context)
context - the JAXB contextpublic Object get()
public void set(Object content)
content - the root JAXB objectpublic JAXBHandle with(Object content)
content - the root JAXB objectpublic void setFormat(Format format)
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OutputStreamSender>format - the format of the contentpublic JAXBHandle withMimetype(String mimetype)
mimetype - the mime type of the contentpublic void fromBuffer(byte[] buffer)
fromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic String toString()
public void write(OutputStream out) throws IOException
OutputStreamSenderwrite in interface OutputStreamSenderout - the output stream receiving the contentIOExceptionCopyright © 2013-2014 MarkLogic Corporation.