public class XMLEventReaderHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<XMLEventReader>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, Closeable
UNKNOWN_LENGTH| Constructor and Description |
|---|
XMLEventReaderHandle()
Zero-argument constructor.
|
XMLEventReaderHandle(XMLEventReader content)
Initializes the handle with a StAX event reader for the content.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Either call close() or get().close() when finished with this handle to close the underlying InputStream.
|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a byte array buffer encoded in UTF-8.
|
XMLEventReader |
get()
Returns an XML Event Reader for for reading a resource from the database as a series of StAX events.
|
XMLInputFactory |
getFactory()
Returns the factory for parsing StAX events.
|
XMLResolver |
getResolver()
Returns the resolver for resolving references while parsing the event reader source.
|
static ContentHandleFactory |
newFactory()
Creates a factory to create an XMLEventReaderHandle instance for a StAX event reader.
|
void |
set(XMLEventReader content)
Assigns the event reader for the content.
|
void |
setFactory(XMLInputFactory factory)
Specifies the factory for parsing StAX events.
|
void |
setFormat(Format format)
Restricts the format to XML.
|
void |
setResolver(XMLResolver resolver)
Specifies the resolver for resolving references while parsing the event reader source.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer encoded in UTF-8.
|
String |
toString()
Buffers the StAX event source and returns the buffer as an XML string.
|
XMLEventReaderHandle |
with(XMLEventReader content)
Assigns an event reader for the content and returns the handle as a fluent convenience.
|
XMLEventReaderHandle |
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, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic XMLEventReaderHandle()
Zero-argument constructor.
public XMLEventReaderHandle(XMLEventReader content)
Initializes the handle with a StAX event reader for the content.
content - a StAX event readerpublic static ContentHandleFactory newFactory()
Creates a factory to create an XMLEventReaderHandle instance for a StAX event reader.
public XMLResolver getResolver()
Returns the resolver for resolving references while parsing the event reader source.
public void setResolver(XMLResolver resolver)
Specifies the resolver for resolving references while parsing the event reader source.
resolver - the reference resolverpublic XMLEventReader get()
Returns an XML Event Reader for for reading a resource from the database as a series of StAX events.
When finished with the event reader, close the event reader to release the response.
get in interface ContentHandle<XMLEventReader>public void set(XMLEventReader content)
Assigns the event reader for the content.
set in interface ContentHandle<XMLEventReader>content - a StAX event readerpublic XMLEventReaderHandle with(XMLEventReader content)
Assigns an event reader for the content and returns the handle as a fluent convenience.
content - a StAX event readerpublic void setFormat(Format format)
Restricts the format to XML.
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OutputStreamSender>format - the format of the contentpublic XMLEventReaderHandle withMimetype(String mimetype)
Specifies the mime type of the content and returns the handle as a fluent convenience.
mimetype - the mime type 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()
Buffers the StAX event source and returns the buffer as an XML string.
public XMLInputFactory getFactory()
Returns the factory for parsing StAX events.
public void setFactory(XMLInputFactory factory)
Specifies the factory for parsing StAX events.
factory - the StAX factorypublic 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 arisepublic void close()
Either call close() or get().close() when finished with this handle to close the underlying InputStream.
close in interface Closeableclose in interface AutoCloseableCopyright © 2013-2017 MarkLogic Corporation.