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, setByteLength, setMimetype
public XMLEventReaderHandle()
public XMLEventReaderHandle(XMLEventReader content)
content
- a StAX event readerpublic static ContentHandleFactory newFactory()
public XMLResolver getResolver()
public void setResolver(XMLResolver resolver)
resolver
- the reference resolverpublic XMLEventReader get()
get
in interface ContentHandle<XMLEventReader>
public void set(XMLEventReader content)
set
in interface ContentHandle<XMLEventReader>
content
- a StAX event readerpublic XMLEventReaderHandle with(XMLEventReader content)
content
- a StAX event readerpublic void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<InputStream,OutputStreamSender>
format
- the format of the contentpublic XMLEventReaderHandle withMimetype(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 String toString()
public XMLInputFactory getFactory()
public void setFactory(XMLInputFactory factory)
factory
- the StAX factorypublic void write(OutputStream out) throws IOException
OutputStreamSender
write
in interface OutputStreamSender
out
- the output stream receiving the contentIOException
- if io problems arisepublic void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2013-2016 MarkLogic Corporation.