ContentDescriptor
, AbstractReadHandle
, AbstractWriteHandle
, BufferableHandle
, ContentHandle<javax.xml.stream.XMLEventReader>
, CtsQueryWriteHandle
, DocumentMetadataReadHandle
, DocumentMetadataWriteHandle
, DocumentPatchHandle
, QueryOptionsListReadHandle
, QueryOptionsReadHandle
, QueryOptionsWriteHandle
, RuleListReadHandle
, RuleReadHandle
, RuleWriteHandle
, SearchReadHandle
, SPARQLResultsReadHandle
, StructureReadHandle
, StructureWriteHandle
, TriplesReadHandle
, TriplesWriteHandle
, TuplesReadHandle
, ValuesListReadHandle
, ValuesReadHandle
, XMLReadHandle
, XMLWriteHandle
, OutputStreamSender
, java.io.Closeable
, java.lang.AutoCloseable
public class XMLEventReaderHandle extends BaseHandle<java.io.InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<javax.xml.stream.XMLEventReader>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, java.io.Closeable
UNKNOWN_LENGTH
Constructor | Description |
---|---|
XMLEventReaderHandle() |
Zero-argument constructor.
|
XMLEventReaderHandle(javax.xml.stream.XMLEventReader content) |
Initializes the handle with a StAX event reader for the content.
|
Modifier and Type | Method | 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.
|
javax.xml.stream.XMLEventReader |
get() |
Returns an XML Event Reader reading a resource from the database
as a series of StAX events.
|
javax.xml.stream.XMLInputFactory |
getFactory() |
Returns the factory for parsing StAX events.
|
javax.xml.stream.XMLResolver |
getResolver() |
Returns the resolver for resolving references while parsing
the event reader source.
|
protected javax.xml.stream.XMLInputFactory |
makeXMLInputFactory() |
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create an XMLEventReaderHandle instance for a StAX event reader.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream content) |
|
protected OutputStreamSender |
sendContent() |
|
void |
set(javax.xml.stream.XMLEventReader content) |
Assigns the event reader for the content.
|
void |
setFactory(javax.xml.stream.XMLInputFactory factory) |
Specifies the factory for parsing StAX events.
|
void |
setFormat(Format format) |
Restricts the format to XML.
|
void |
setResolver(javax.xml.stream.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.
|
java.lang.String |
toString() |
Buffers the StAX event source and returns the buffer
as an XML string.
|
XMLEventReaderHandle |
with(javax.xml.stream.XMLEventReader content) |
Assigns an event reader for the content and returns the handle
as a fluent convenience.
|
XMLEventReaderHandle |
withMimetype(java.lang.String mimetype) |
Specifies the mime type of the content and returns the handle
as a fluent convenience.
|
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
public XMLEventReaderHandle()
public XMLEventReaderHandle(javax.xml.stream.XMLEventReader content)
content
- a StAX event readerpublic static ContentHandleFactory newFactory()
public javax.xml.stream.XMLResolver getResolver()
public void setResolver(javax.xml.stream.XMLResolver resolver)
resolver
- the reference resolverpublic javax.xml.stream.XMLEventReader get()
get
in interface ContentHandle<javax.xml.stream.XMLEventReader>
public void set(javax.xml.stream.XMLEventReader content)
set
in interface ContentHandle<javax.xml.stream.XMLEventReader>
content
- a StAX event readerpublic XMLEventReaderHandle with(javax.xml.stream.XMLEventReader content)
content
- a StAX event readerpublic void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<java.io.InputStream,OutputStreamSender>
format
- the format of the contentpublic XMLEventReaderHandle withMimetype(java.lang.String mimetype)
mimetype
- the mime type of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandle
fromBuffer
in interface BufferableHandle
buffer
- the byte arraypublic byte[] toBuffer()
BufferableHandle
toBuffer
in interface BufferableHandle
public java.lang.String toString()
toString
in class java.lang.Object
public javax.xml.stream.XMLInputFactory getFactory()
public void setFactory(javax.xml.stream.XMLInputFactory factory)
factory
- the StAX factoryprotected javax.xml.stream.XMLInputFactory makeXMLInputFactory()
protected 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 content)
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 arisepublic void close()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
Copyright © 2013-2019 MarkLogic Corporation.