public class XMLStreamReaderHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<XMLStreamReader>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle
close()
to release
the response.UNKNOWN_LENGTH
Constructor and Description |
---|
XMLStreamReaderHandle()
Zero-argument constructor.
|
XMLStreamReaderHandle(XMLStreamReader content)
Initializes the handle with a StAX stream reader for the content.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the XMLStreamReader and the InputStream, if any, used to populate
the XMLStreamReader.
|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a byte array buffer
encoded in UTF-8.
|
XMLStreamReader |
get()
Returns an XML Stream Reader for for reading a resource from the database
as a StAX pull stream.
|
XMLInputFactory |
getFactory()
Returns the factory for parsing StAX streams.
|
XMLResolver |
getResolver()
Returns the resolver for resolving references while parsing
the event reader source.
|
static ContentHandleFactory |
newFactory()
Creates a factory to create an XMLStreamReaderHandle instance for a StAX stream reader.
|
void |
set(XMLStreamReader content)
Assigns the stream reader for the content.
|
void |
setFactory(XMLInputFactory factory)
Specifies the factory for parsing StAX streams.
|
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 stream and returns the buffer as an XML string.
|
XMLStreamReaderHandle |
with(XMLStreamReader content)
Assigns an stream reader for the content and returns the handle
as a fluent convenience.
|
XMLStreamReaderHandle |
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 XMLStreamReaderHandle()
public XMLStreamReaderHandle(XMLStreamReader content)
content
- a StAX stream readerpublic static ContentHandleFactory newFactory()
public XMLResolver getResolver()
public void setResolver(XMLResolver resolver)
resolver
- the reference resolverpublic XMLStreamReader get()
close()
to release
the response.get
in interface ContentHandle<XMLStreamReader>
public void set(XMLStreamReader content)
set
in interface ContentHandle<XMLStreamReader>
content
- a StAX stream readerpublic XMLStreamReaderHandle with(XMLStreamReader content)
content
- a StAX stream readerpublic void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<InputStream,OutputStreamSender>
format
- the format of the contentpublic XMLStreamReaderHandle 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 void close() throws XMLStreamException, IOException
XMLStreamException
IOException
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
Copyright © 2013-2015 MarkLogic Corporation.