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