public class DOM4JHandle extends BaseHandle<java.io.InputStream,OutputStreamSender> implements ResendableContentHandle<org.dom4j.Document,java.io.InputStream>, OutputStreamSender, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle
UNKNOWN_LENGTH
Constructor and Description |
---|
DOM4JHandle()
Zero-argument constructor.
|
DOM4JHandle(org.dom4j.Document content)
Provides a handle on XML content as a dom4j document structure.
|
Modifier and Type | Method and Description |
---|---|
org.dom4j.Document |
bytesToContent(byte[] buffer)
Converts a byte serialization to the content representation.
|
byte[] |
contentToBytes(org.dom4j.Document content)
Converts the content representation to bytes.
|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a byte array buffer
encoded in UTF-8.
|
org.dom4j.Document |
get()
Returns the XML document structure.
|
java.lang.Class<org.dom4j.Document> |
getContentClass()
Returns the class of the handled content, which may be a base
class of the actual class of a content object.
|
org.dom4j.io.OutputFormat |
getOutputFormat()
Returns the dom4j output format for serializing XML content.
|
org.dom4j.io.SAXReader |
getReader()
Returns the dom4j reader for XML content.
|
protected org.dom4j.io.SAXReader |
makeReader() |
static ContentHandleFactory |
newFactory()
Creates a factory to create a DOM4JHandle instance for a dom4j document.
|
DOM4JHandle |
newHandle()
Constructs a new handle for the same content representation,
initializing the new handle with the same format and mime type.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
protected void |
receiveContent(java.io.InputStream serialization) |
protected OutputStreamSender |
sendContent() |
void |
set(org.dom4j.Document content)
Assigns an XML document structure as the content.
|
void |
setFormat(Format format)
Restricts the format to XML.
|
void |
setOutputFormat(org.dom4j.io.OutputFormat outputFormat)
Specifies the dom4j output format for serializing XML content.
|
void |
setReader(org.dom4j.io.SAXReader reader)
Specifies a dom4j reader for XML content.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
org.dom4j.Document |
toContent(java.io.InputStream serialization)
Converts the serialization to the content representation.
|
java.lang.String |
toString()
Returns the XML document as a string.
|
DOM4JHandle |
with(org.dom4j.Document content)
Assigns an XML document structure as the content and returns the handle.
|
void |
write(java.io.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, setServerTimestamp
getPointInTimeQueryTimestamp, isResendable, setPointInTimeQueryTimestamp, setResendable, setResponseServerTimestamp
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
resendableHandleFor
resendableHandleFor
newArray, newHandle
public DOM4JHandle()
public DOM4JHandle(org.dom4j.Document content)
content
- the XML document.public static ContentHandleFactory newFactory()
public DOM4JHandle newHandle()
ContentHandle
newHandle
in interface ContentHandle<org.dom4j.Document>
public org.dom4j.io.SAXReader getReader()
public void setReader(org.dom4j.io.SAXReader reader)
reader
- the dom4j reader.protected org.dom4j.io.SAXReader makeReader()
public org.dom4j.io.OutputFormat getOutputFormat()
public void setOutputFormat(org.dom4j.io.OutputFormat outputFormat)
outputFormat
- the output format.public org.dom4j.Document get()
get
in interface ContentHandle<org.dom4j.Document>
public void set(org.dom4j.Document content)
set
in interface ContentHandle<org.dom4j.Document>
content
- the XML document.public DOM4JHandle with(org.dom4j.Document content)
content
- the XML document.public java.lang.Class<org.dom4j.Document> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<org.dom4j.Document>
public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<java.io.InputStream,OutputStreamSender>
format
- the format of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandle
fromBuffer
in interface BufferableHandle
buffer
- the byte arraypublic byte[] toBuffer()
BufferableHandle
toBuffer
in interface BufferableHandle
public org.dom4j.Document bytesToContent(byte[] buffer)
BufferableContentHandle
bytesToContent
in interface BufferableContentHandle<org.dom4j.Document,java.io.InputStream>
buffer
- the byte serializationpublic byte[] contentToBytes(org.dom4j.Document content)
BufferableContentHandle
contentToBytes
in interface BufferableContentHandle<org.dom4j.Document,java.io.InputStream>
content
- the contentpublic java.lang.String toString()
toString
in class java.lang.Object
public org.dom4j.Document toContent(java.io.InputStream serialization)
BufferableContentHandle
toContent
in interface BufferableContentHandle<org.dom4j.Document,java.io.InputStream>
serialization
- a serialization of the contentprotected java.lang.Class<java.io.InputStream> receiveAs()
receiveAs
in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>
protected void receiveContent(java.io.InputStream serialization)
receiveContent
in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>
protected OutputStreamSender sendContent()
sendContent
in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>
public void write(java.io.OutputStream out) throws java.io.IOException
OutputStreamSender
write
in interface OutputStreamSender
out
- the output stream receiving the contentjava.io.IOException
- if io problems ariseCopyright © 2013-2020 MarkLogic Corporation.