public class XOMHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<nu.xom.Document>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle
UNKNOWN_LENGTH
Constructor and Description |
---|
XOMHandle()
Zero-argument constructor.
|
XOMHandle(nu.xom.Document content)
Provides a handle on XML content as a XOM 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.
|
nu.xom.Document |
get()
Returns the XML document structure.
|
nu.xom.Builder |
getBuilder()
Returns the XOM structure builder for XML content.
|
static ContentHandleFactory |
newFactory()
Creates a factory to create a XOMHandle instance for a XOM document.
|
void |
set(nu.xom.Document content)
Assigns an XML document structure as the content.
|
void |
setBuilder(nu.xom.Builder builder)
Specifies a XOM structure builder for XML 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 XML document as a string.
|
XOMHandle |
with(nu.xom.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, setByteLength, setMimetype
public XOMHandle()
public XOMHandle(nu.xom.Document content)
content
- the XML document.public static ContentHandleFactory newFactory()
public nu.xom.Builder getBuilder()
public void setBuilder(nu.xom.Builder builder)
builder
- the XOM builder.public nu.xom.Document get()
get
in interface ContentHandle<nu.xom.Document>
public void set(nu.xom.Document content)
set
in interface ContentHandle<nu.xom.Document>
content
- the XML document.public XOMHandle with(nu.xom.Document content)
content
- the XML document.public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<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 String toString()
public void write(OutputStream out) throws IOException
OutputStreamSender
write
in interface OutputStreamSender
out
- the output stream receiving the contentIOException
Copyright © 2013-2015 MarkLogic Corporation.