ContentDescriptor
,
AbstractReadHandle
,
AbstractWriteHandle
,
BinaryReadHandle
,
BinaryWriteHandle
,
BufferableContentHandle<java.io.InputStream,java.io.InputStream>
,
BufferableHandle
,
ContentHandle<java.io.InputStream>
,
CtsQueryWriteHandle
,
DocumentMetadataReadHandle
,
DocumentMetadataWriteHandle
,
DocumentPatchHandle
,
GenericReadHandle
,
GenericWriteHandle
,
JSONReadHandle
,
JSONWriteHandle
,
QuadsWriteHandle
,
QueryOptionsListReadHandle
,
QueryOptionsReadHandle
,
QueryOptionsWriteHandle
,
RuleListReadHandle
,
RuleReadHandle
,
RuleWriteHandle
,
SearchReadHandle
,
SPARQLResultsReadHandle
,
StreamingContentHandle<java.io.InputStream,java.io.InputStream>
,
StructureReadHandle
,
StructureWriteHandle
,
TextReadHandle
,
TextWriteHandle
,
TriplesReadHandle
,
TriplesWriteHandle
,
TuplesReadHandle
,
ValuesListReadHandle
,
ValuesReadHandle
,
XMLReadHandle
,
XMLWriteHandle
,
java.io.Closeable
,
java.lang.AutoCloseable
public class InputStreamHandle extends BaseHandle<java.io.InputStream,java.io.InputStream> implements StreamingContentHandle<java.io.InputStream,java.io.InputStream>, BinaryReadHandle, BinaryWriteHandle, GenericReadHandle, GenericWriteHandle, JSONReadHandle, JSONWriteHandle, TextReadHandle, TextWriteHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, TriplesReadHandle, TriplesWriteHandle, QuadsWriteHandle, SPARQLResultsReadHandle, java.io.Closeable
An InputStreamHandle represents a resource as an InputStream for reading or writing.
When writing JSON, text, or XML content, you should use an
InputStream only if the stream is encoded in UTF-8. If the
characters have a different encoding, use a ReaderHandle
and specify the correct character encoding for the stream when
creating the Reader.
Either call
close()
or
get()
.close() when finished with this handle to release
the resources.
UNKNOWN_LENGTH
Constructor | Description |
---|---|
InputStreamHandle() |
Zero-argument constructor.
|
InputStreamHandle(java.io.InputStream content) |
Initializes the handle with an input stream for
the content.
|
Modifier and Type | Method | Description |
---|---|---|
java.io.InputStream |
bytesToContent(byte[] buffer) |
Converts a byte serialization to the content
representation.
|
void |
close() |
Either call close() or get().close() when
finished with this handle to close the underlying
InputStream.
|
byte[] |
contentToBytes(java.io.InputStream 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.
|
java.io.InputStream |
get() |
Returns an input stream for a resource read from
the database.
|
java.lang.Class<java.io.InputStream> |
getContentClass() |
Returns the class of the handled content, which
may be a base class of the actual class of a content object.
|
java.io.InputStream[] |
newArray(int length) |
Constructs an array for the handled content
representation
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create an InputStreamHandle
instance for an input stream.
|
InputStreamHandle |
newHandle() |
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
|
InputStreamHandle[] |
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
java.io.InputStream |
sendContent() |
|
void |
set(java.io.InputStream content) |
Assigns an input stream as the content.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
|
java.io.InputStream |
toContent(java.io.InputStream serialization) |
Converts the serialization to the content
representation.
|
java.lang.String |
toString() |
Buffers the input stream and returns the buffer
as a string with the assumption that the stream is encoded in
UTF-8.
|
InputStreamHandle |
with(java.io.InputStream content) |
Assigns an input stream as the content and
returns the handle as a fluent convenience.
|
InputStreamHandle |
withFormat(Format format) |
Specifies the format of the content and returns
the handle as a fluent convenience.
|
InputStreamHandle |
withMimetype(java.lang.String mimetype) |
Specifies the mime type of the content and
returns the handle as a fluent convenience.
|
getByteLength,
getFormat,
getMimetype,
getServerTimestamp,
setByteLength,
setFormat,
setMimetype,
setServerTimestamp
newHandle,
resendableHandleFor
getPointInTimeQueryTimestamp, isResendable,
setPointInTimeQueryTimestamp, setResendable,
setResponseServerTimestamp
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, wait, wait, wait
resendableHandleFor
public InputStreamHandle()
public InputStreamHandle(java.io.InputStream content)
content
- an input streampublic static ContentHandleFactory newFactory()
public java.io.InputStream get()
get
in interface ContentHandle<java.io.InputStream>
public void set(java.io.InputStream content)
set
in interface ContentHandle<java.io.InputStream>
content
- an input streampublic InputStreamHandle with(java.io.InputStream content)
content
- an input streampublic java.lang.Class<java.io.InputStream> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<java.io.InputStream>
public InputStreamHandle newHandle()
ContentHandle
newHandle
in interface BufferableContentHandle<java.io.InputStream,java.io.InputStream>
newHandle
in interface ContentHandle<java.io.InputStream>
public InputStreamHandle[] newHandleArray(int length)
BufferableContentHandle
newHandleArray
in interface BufferableContentHandle<java.io.InputStream,java.io.InputStream>
length
- the number of positions in the arraypublic java.io.InputStream[] newArray(int length)
ContentHandle
newArray
in interface ContentHandle<java.io.InputStream>
length
- the size of the array (zero or more)public InputStreamHandle withFormat(Format format)
format
- the format of the contentpublic InputStreamHandle 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.io.InputStream bytesToContent(byte[] buffer)
BufferableContentHandle
bytesToContent
in interface BufferableContentHandle<java.io.InputStream,java.io.InputStream>
buffer
- the byte serializationpublic byte[] contentToBytes(java.io.InputStream content)
BufferableContentHandle
contentToBytes
in interface BufferableContentHandle<java.io.InputStream,java.io.InputStream>
content
- the contentpublic java.io.InputStream toContent(java.io.InputStream serialization)
BufferableContentHandle
toContent
in interface BufferableContentHandle<java.io.InputStream,java.io.InputStream>
serialization
- a serialization of the
contentpublic java.lang.String toString()
toString
in
class java.lang.Object
protected java.lang.Class<java.io.InputStream> receiveAs()
receiveAs
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.io.InputStream>
protected void receiveContent(java.io.InputStream content)
receiveContent
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.io.InputStream>
protected java.io.InputStream sendContent()
sendContent
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.io.InputStream>
public void close()
close
in
interface java.lang.AutoCloseable
close
in
interface java.io.Closeable
Copyright © 2022 MarkLogic Corporation