public class XMLStreamReaderHandle extends BaseHandle<java.io.InputStream,OutputStreamSender> implements OutputStreamSender, StreamingContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, java.io.Closeable
UNKNOWN_LENGTH
Constructor and Description |
---|
XMLStreamReaderHandle()
Zero-argument constructor.
|
XMLStreamReaderHandle(javax.xml.stream.XMLStreamReader content)
Initializes the handle with a StAX stream reader
for the content.
|
Modifier and Type | Method and Description |
---|---|
javax.xml.stream.XMLStreamReader |
bytesToContent(byte[] buffer)
Converts a byte serialization to the content
representation.
|
void |
close()
Closes the XMLStreamReader and the InputStream,
if any, used to populate the XMLStreamReader.
|
byte[] |
contentToBytes(javax.xml.stream.XMLStreamReader content)
Converts the content representation to
bytes.
|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a
byte array buffer encoded in UTF-8.
|
javax.xml.stream.XMLStreamReader |
get()
Returns an XML Stream Reader for reading a
resource from the database as a StAX pull stream.
|
java.lang.Class<javax.xml.stream.XMLStreamReader> |
getContentClass()
Returns the class of the handled content, which
may be a base class of the actual class of a content object.
|
javax.xml.stream.XMLInputFactory |
getFactory()
Returns the factory for parsing StAX
streams.
|
javax.xml.stream.XMLResolver |
getResolver()
Returns the resolver for resolving references
while parsing the event reader source.
|
protected
javax.xml.stream.XMLInputFactory |
makeXMLInputFactory() |
javax.xml.stream.XMLStreamReader[] |
newArray(int length)
Constructs an array for the handled content
representation
|
static ContentHandleFactory |
newFactory()
Creates a factory to create an
XMLStreamReaderHandle instance for a StAX stream reader.
|
XMLStreamReaderHandle |
newHandle()
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
|
XMLStreamReaderHandle[] |
newHandleArray(int length)
Constructs an uninitialized array with the
specified length with items of the same content
representation.
|
protected
java.lang.Class<java.io.InputStream> |
receiveAs() |
protected void |
receiveContent(java.io.InputStream content) |
protected OutputStreamSender |
sendContent() |
void |
set(javax.xml.stream.XMLStreamReader content)
Assigns the stream reader for the content.
|
void |
setFactory(javax.xml.stream.XMLInputFactory factory)
Specifies the factory for parsing StAX
streams.
|
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.
|
javax.xml.stream.XMLStreamReader |
toContent(java.io.InputStream serialization)
Converts the serialization to the content
representation.
|
java.lang.String |
toString()
Buffers the StAX stream and returns the buffer
as an XML string.
|
XMLStreamReaderHandle |
with(javax.xml.stream.XMLStreamReader content)
Assigns an stream reader for the content and
returns the handle as a fluent convenience.
|
XMLStreamReaderHandle |
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
getPointInTimeQueryTimestamp, isResendable,
setPointInTimeQueryTimestamp, setResendable,
setResponseServerTimestamp
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, wait, wait, wait
resendableHandleFor
newHandle,
resendableHandleFor
public XMLStreamReaderHandle()
public XMLStreamReaderHandle(javax.xml.stream.XMLStreamReader content)
content
- a StAX stream 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.XMLStreamReader get()
close()
to release the response.
get
in interface ContentHandle<javax.xml.stream.XMLStreamReader>
public void set(javax.xml.stream.XMLStreamReader content)
set
in interface ContentHandle<javax.xml.stream.XMLStreamReader>
content
- a StAX stream readerpublic XMLStreamReaderHandle with(javax.xml.stream.XMLStreamReader content)
content
- a StAX stream readerpublic java.lang.Class<javax.xml.stream.XMLStreamReader> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<javax.xml.stream.XMLStreamReader>
public XMLStreamReaderHandle newHandle()
ContentHandle
newHandle
in interface BufferableContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>
newHandle
in interface ContentHandle<javax.xml.stream.XMLStreamReader>
public XMLStreamReaderHandle[] newHandleArray(int length)
BufferableContentHandle
newHandleArray
in interface BufferableContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>
length
- the number of positions in the arraypublic javax.xml.stream.XMLStreamReader[] newArray(int length)
ContentHandle
newArray
in interface ContentHandle<javax.xml.stream.XMLStreamReader>
length
- the size of the array (zero or more)public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<java.io.InputStream,OutputStreamSender>
format
- the format of the contentpublic XMLStreamReaderHandle 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 javax.xml.stream.XMLStreamReader toContent(java.io.InputStream serialization)
BufferableContentHandle
toContent
in interface BufferableContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>
serialization
- a serialization of the
contentpublic javax.xml.stream.XMLStreamReader bytesToContent(byte[] buffer)
BufferableContentHandle
bytesToContent
in interface BufferableContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>
buffer
- the byte serializationpublic byte[] contentToBytes(javax.xml.stream.XMLStreamReader content)
BufferableContentHandle
contentToBytes
in interface BufferableContentHandle<javax.xml.stream.XMLStreamReader,java.io.InputStream>
content
- the contentpublic void close()
close
in
interface java.io.Closeable
close
in
interface java.lang.AutoCloseable
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 ariseCopyright © 2024 MarkLogic Corporation. All Rights Reserved.