public class JDOMHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<org.jdom2.Document>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle
A JDOM Handle represents XML content as a JDOM document for reading or writing. You must install the JDOM library to use this class.
UNKNOWN_LENGTH| Constructor and Description |
|---|
JDOMHandle()
Zero-argument constructor.
|
JDOMHandle(org.jdom2.Document content)
Provides a handle on XML content as a JDOM document structure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a byte array buffer encoded in UTF-8.
|
org.jdom2.Document |
get()
Returns the XML document structure.
|
org.jdom2.input.SAXBuilder |
getBuilder()
Returns the JDOM structure builder for XML content.
|
org.jdom2.output.XMLOutputter |
getOutputter()
Returns the JDOM serializer for XML content.
|
static ContentHandleFactory |
newFactory()
Creates a factory to create a JDOMHandle instance for a JDOM document.
|
void |
set(org.jdom2.Document content)
Assigns an XML document structure as the content.
|
void |
setBuilder(org.jdom2.input.SAXBuilder builder)
Specifies a JDOM structure builder for XML content.
|
void |
setFormat(Format format)
Restricts the format to XML.
|
void |
setOutputter(org.jdom2.output.XMLOutputter outputter)
Specifies a JDOM serializer for XML content.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer encoded in UTF-8.
|
String |
toString()
Returns the XML document as a string.
|
JDOMHandle |
with(org.jdom2.Document content)
Assigns an XML document structure as the content and returns the handle.
|
void |
write(OutputStream out)
Implements a callback to write content to the provided output stream for sending to the database server.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic JDOMHandle()
Zero-argument constructor.
public JDOMHandle(org.jdom2.Document content)
Provides a handle on XML content as a JDOM document structure.
content - the XML document.public static ContentHandleFactory newFactory()
Creates a factory to create a JDOMHandle instance for a JDOM document.
public org.jdom2.input.SAXBuilder getBuilder()
Returns the JDOM structure builder for XML content.
public void setBuilder(org.jdom2.input.SAXBuilder builder)
Specifies a JDOM structure builder for XML content.
builder - the JDOM builder.public org.jdom2.output.XMLOutputter getOutputter()
Returns the JDOM serializer for XML content.
public void setOutputter(org.jdom2.output.XMLOutputter outputter)
Specifies a JDOM serializer for XML content.
outputter - the JDOM serializer.public org.jdom2.Document get()
Returns the XML document structure.
get in interface ContentHandle<org.jdom2.Document>public void set(org.jdom2.Document content)
Assigns an XML document structure as the content.
set in interface ContentHandle<org.jdom2.Document>content - the XML document.public JDOMHandle with(org.jdom2.Document content)
Assigns an XML document structure as the content and returns the handle.
content - the XML document.public void setFormat(Format format)
Restricts the format to XML.
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OutputStreamSender>format - the format of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandleSets the content of the handle by copying from a byte array buffer encoded in UTF-8.
fromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandleCopies the content of the handle to a byte array buffer encoded in UTF-8.
toBuffer in interface BufferableHandlepublic String toString()
Returns the XML document as a string.
public void write(OutputStream out) throws IOException
OutputStreamSenderImplements a callback to write content to the provided output stream for sending to the database server.
write in interface OutputStreamSenderout - the output stream receiving the contentIOException - if io problems ariseCopyright © 2013-2017 MarkLogic Corporation.