ContentDescriptor
,
AbstractReadHandle
,
AbstractWriteHandle
,
BinaryReadHandle
,
BinaryWriteHandle
,
BufferableHandle
,
ContentHandle<byte[]>
,
CtsQueryWriteHandle
,
DocumentMetadataReadHandle
,
DocumentMetadataWriteHandle
,
DocumentPatchHandle
,
GenericReadHandle
,
GenericWriteHandle
,
JSONReadHandle
,
JSONWriteHandle
,
QuadsWriteHandle
,
QueryOptionsListReadHandle
,
QueryOptionsReadHandle
,
QueryOptionsWriteHandle
,
RuleListReadHandle
,
RuleReadHandle
,
RuleWriteHandle
,
SearchReadHandle
,
SPARQLResultsReadHandle
,
StructureReadHandle
,
StructureWriteHandle
,
TextReadHandle
,
TextWriteHandle
,
TriplesReadHandle
,
TriplesWriteHandle
,
TuplesReadHandle
,
ValuesListReadHandle
,
ValuesReadHandle
,
XMLReadHandle
,
XMLWriteHandle
public class BytesHandle extends BaseHandle<byte[],byte[]> implements BufferableHandle, ContentHandle<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
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a BytesHandle
instance for a byte[] array.
|
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.
|
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
public BytesHandle()
public BytesHandle(byte[] content)
content
- the byte arraypublic 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 with(byte[] content)
content
- the byte arraypublic java.lang.Class<byte[]> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<byte[]>
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 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 © 2013-2019 MarkLogic Corporation.