ContentDescriptor
,
AbstractReadHandle
,
AbstractWriteHandle
,
BinaryReadHandle
,
BinaryWriteHandle
,
BufferableContentHandle<byte[],byte[]>
,
BufferableHandle
,
ContentHandle<byte[]>
,
CtsQueryWriteHandle
,
DocumentMetadataReadHandle
,
DocumentMetadataWriteHandle
,
DocumentPatchHandle
,
GenericReadHandle
,
GenericWriteHandle
,
JSONReadHandle
,
JSONWriteHandle
,
QuadsWriteHandle
,
QueryOptionsListReadHandle
,
QueryOptionsReadHandle
,
QueryOptionsWriteHandle
,
ResendableContentHandle<byte[],byte[]>
,
RuleListReadHandle
,
RuleReadHandle
,
RuleWriteHandle
,
SearchReadHandle
,
SPARQLResultsReadHandle
,
StructureReadHandle
,
StructureWriteHandle
,
TextReadHandle
,
TextWriteHandle
,
TriplesReadHandle
,
TriplesWriteHandle
,
TuplesReadHandle
,
ValuesListReadHandle
,
ValuesReadHandle
,
XMLReadHandle
,
XMLWriteHandle
public class BytesHandle extends BaseHandle<byte[],byte[]> implements ResendableContentHandle<byte[],byte[]>, BinaryReadHandle, BinaryWriteHandle, GenericReadHandle, GenericWriteHandle, JSONReadHandle, JSONWriteHandle, TextReadHandle, TextWriteHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, QuadsWriteHandle, TriplesReadHandle, TriplesWriteHandle
UNKNOWN_LENGTH
Constructor | Description |
---|---|
BytesHandle() |
Zero-argument constructor.
|
BytesHandle(byte[] content) |
Initializes the handle with a byte array for the
content.
|
BytesHandle(BufferableHandle content) |
Initializes the handle from the byte content of
another handle
|
BytesHandle(java.io.InputStream content) |
Initializes the handle by reading a byte array
from an input stream.
|
Modifier and Type | Method | Description |
---|---|---|
byte[] |
bytesToContent(byte[] buffer) |
Converts a byte serialization to the content
representation.
|
byte[] |
contentToBytes(byte[] content) |
Converts the content representation to
bytes.
|
BytesHandle |
from(java.io.InputStream content) |
Assigns a byte array by reading all bytes from
an input stream and returns the handle as a fluent
convenience.
|
void |
fromBuffer(byte[] buffer) |
Sets the content of the handle by copying from a
byte array buffer encoded in UTF-8.
|
byte[] |
get() |
Returns the byte array for the handle
content.
|
java.lang.Class<byte[]> |
getContentClass() |
Returns the class of the handled content, which
may be a base class of the actual class of a content object.
|
byte[][] |
newArray(int length) |
Constructs an array for the handled content
representation
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a BytesHandle
instance for a byte[] array.
|
BytesHandle |
newHandle() |
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
|
BytesHandle[] |
newHandleArray(int length) |
Constructs an uninitialized array with the
specified length with items of the same content
representation.
|
protected
java.lang.Class<byte[]> |
receiveAs() |
|
protected void |
receiveContent(byte[] content) |
|
protected byte[] |
sendContent() |
|
void |
set(byte[] content) |
Assigns a byte array as the content.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
|
byte[] |
toContent(byte[] serialization) |
Converts the serialization to the content
representation.
|
java.lang.String |
toString() |
Returns a byte array as a string with the
assumption that the bytes are encoded in UTF-8.
|
BytesHandle |
with(byte[] content) |
Assigns a byte array as the content and returns
the handle as a fluent convenience.
|
BytesHandle |
withFormat(Format format) |
Specifies the format of the content and returns
the handle as a fluent convenience.
|
BytesHandle |
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
resendableHandleFor
getPointInTimeQueryTimestamp, isResendable,
setPointInTimeQueryTimestamp, setResendable,
setResponseServerTimestamp
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, wait, wait, wait
newHandle,
resendableHandleFor
public BytesHandle()
public BytesHandle(byte[] content)
content
- the byte arraypublic BytesHandle(java.io.InputStream content)
content
- the input stream with the contentpublic BytesHandle(BufferableHandle content)
content
- the other handlepublic static ContentHandleFactory newFactory()
public byte[] get()
get
in interface ContentHandle<byte[]>
public void set(byte[] content)
set
in interface ContentHandle<byte[]>
content
- the byte arraypublic BytesHandle from(java.io.InputStream content)
content
- the input stream with the contentpublic BytesHandle with(byte[] content)
content
- the byte arraypublic java.lang.Class<byte[]> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<byte[]>
public BytesHandle newHandle()
ContentHandle
newHandle
in interface BufferableContentHandle<byte[],byte[]>
newHandle
in interface ContentHandle<byte[]>
newHandle
in interface ResendableContentHandle<byte[],byte[]>
public BytesHandle[] newHandleArray(int length)
BufferableContentHandle
newHandleArray
in interface BufferableContentHandle<byte[],byte[]>
newHandleArray
in interface ResendableContentHandle<byte[],byte[]>
length
- the number of positions in the arraypublic byte[][] newArray(int length)
ContentHandle
newArray
in interface ContentHandle<byte[]>
length
- the size of the array (zero or more)public BytesHandle withFormat(Format format)
format
- the format of the contentpublic BytesHandle 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 byte[] toContent(byte[] serialization)
BufferableContentHandle
toContent
in interface BufferableContentHandle<byte[],byte[]>
serialization
- a serialization of the
contentpublic byte[] bytesToContent(byte[] buffer)
BufferableContentHandle
bytesToContent
in interface BufferableContentHandle<byte[],byte[]>
buffer
- the byte serializationpublic byte[] contentToBytes(byte[] content)
BufferableContentHandle
contentToBytes
in interface BufferableContentHandle<byte[],byte[]>
content
- the contentpublic java.lang.String toString()
toString
in
class java.lang.Object
protected java.lang.Class<byte[]> receiveAs()
receiveAs
in
class com.marklogic.client.impl.HandleImplementation<byte[],byte[]>
protected void receiveContent(byte[] content)
receiveContent
in
class com.marklogic.client.impl.HandleImplementation<byte[],byte[]>
protected byte[] sendContent()
sendContent
in
class com.marklogic.client.impl.HandleImplementation<byte[],byte[]>
Copyright © 2022 MarkLogic Corporation