ContentDescriptor, AbstractReadHandle, AbstractWriteHandle, BufferableHandle, ContentHandle<java.io.Reader>, CtsQueryWriteHandle, DocumentMetadataReadHandle, DocumentMetadataWriteHandle, DocumentPatchHandle, JSONReadHandle, JSONWriteHandle, QuadsWriteHandle, QueryOptionsListReadHandle, QueryOptionsReadHandle, QueryOptionsWriteHandle, RuleListReadHandle, RuleReadHandle, RuleWriteHandle, SearchReadHandle, SPARQLResultsReadHandle, StructureReadHandle, StructureWriteHandle, TextReadHandle, TextWriteHandle, TriplesReadHandle, TriplesWriteHandle, TuplesReadHandle, ValuesListReadHandle, ValuesReadHandle, XMLReadHandle, XMLWriteHandle, OutputStreamSender, java.io.Closeable, java.lang.AutoCloseablepublic class ReaderHandle extends BaseHandle<java.io.InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<java.io.Reader>, JSONReadHandle, JSONWriteHandle, TextReadHandle, TextWriteHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, QuadsWriteHandle, TriplesReadHandle, TriplesWriteHandle, java.io.Closeable
UNKNOWN_LENGTH| Constructor | Description |
|---|---|
ReaderHandle() |
Zero-argument constructor.
|
ReaderHandle(java.io.Reader content) |
Initializes the handle with a character 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 Reader.
|
void |
fromBuffer(byte[] buffer) |
Sets the content of the handle by copying from a byte array buffer
encoded in UTF-8.
|
java.io.Reader |
get() |
Returns a character reader for reading content.
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a ReaderHandle instance for a Reader.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream content) |
|
protected ReaderHandle |
sendContent() |
|
void |
set(java.io.Reader content) |
Assigns an character reader as the content.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
java.lang.String |
toString() |
Buffers the character stream and returns the buffer as a string.
|
ReaderHandle |
with(java.io.Reader content) |
Assigns a character reader as the content and returns the handle
as a fluent convenience.
|
ReaderHandle |
withFormat(Format format) |
Specifies the format of the content and returns the handle
as a fluent convenience.
|
ReaderHandle |
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, setFormat, setMimetype, setServerTimestamppublic ReaderHandle()
public ReaderHandle(java.io.Reader content)
content - a character readerpublic static ContentHandleFactory newFactory()
public java.io.Reader get()
get in interface ContentHandle<java.io.Reader>public void set(java.io.Reader content)
set in interface ContentHandle<java.io.Reader>content - a readerpublic ReaderHandle with(java.io.Reader content)
content - a readerpublic ReaderHandle withFormat(Format format)
format - the format of the contentpublic ReaderHandle withMimetype(java.lang.String mimetype)
mimetype - the mime type of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandlefromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic java.lang.String toString()
toString in class java.lang.Objectprotected 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 ReaderHandle sendContent()
sendContent in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>public void write(java.io.OutputStream out)
throws java.io.IOException
OutputStreamSenderwrite in interface OutputStreamSenderout - the output stream receiving the contentjava.io.IOException - if io problems arisepublic void close()
close in interface java.lang.AutoCloseableclose in interface java.io.CloseableCopyright © 2013-2019 MarkLogic Corporation.