public class DOMHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle
UNKNOWN_LENGTH| Constructor and Description |
|---|
DOMHandle()
Zero-argument constructor.
|
DOMHandle(Document content)
Initializes the handle with a DOM document for the content.
|
| 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.
|
Document |
get()
Returns the DOM document for the content.
|
DocumentBuilderFactory |
getFactory()
Returns the factory for building DOM documents.
|
LSResourceResolver |
getResolver()
Returns the resolver for resolving references while parsing the document.
|
void |
set(Document content)
Assigns a DOM document as the content.
|
void |
setFactory(DocumentBuilderFactory factory)
Specifies the factory for building DOM documents.
|
void |
setFormat(Format format)
Restricts the format to XML.
|
void |
setResolver(LSResourceResolver resolver)
Specifies the resolver for resolving references while parsing the document.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
String |
toString()
Returns the DOM document as an XML string.
|
DOMHandle |
with(Document content)
Assigns a DOM document as the content and returns the handle
as a fluent convenience.
|
DOMHandle |
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 DOMHandle()
public DOMHandle(Document content)
content - a DOM documentpublic LSResourceResolver getResolver()
public void setResolver(LSResourceResolver resolver)
resolver - the reference resolverpublic Document get()
public void set(Document content)
content - a DOM documentpublic DOMHandle with(Document content)
content - a DOM documentpublic void setFormat(Format format)
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OutputStreamSender>format - the format of the contentpublic DOMHandle withMimetype(String mimetype)
mimetype - the mime type of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandlefromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic String toString()
public DocumentBuilderFactory getFactory() throws ParserConfigurationException
ParserConfigurationExceptionpublic void setFactory(DocumentBuilderFactory factory)
factory - the document factorypublic void write(OutputStream out) throws IOException
OutputStreamSenderwrite in interface OutputStreamSenderout - the output stream receiving the contentIOExceptionCopyright © 2013-2014 MarkLogic Corporation.