All Implemented Interfaces:
ContentDescriptor ,
AbstractReadHandle ,
AbstractWriteHandle ,
BufferableContentHandle <String , byte[]>, BufferableHandle ,
ContentHandle <String >, CtsQueryWriteHandle ,
DocumentMetadataReadHandle ,
DocumentMetadataWriteHandle ,
DocumentPatchHandle ,
JSONReadHandle ,
JSONWriteHandle ,
QuadsWriteHandle ,
QueryOptionsListReadHandle ,
QueryOptionsReadHandle ,
QueryOptionsWriteHandle ,
ResendableContentHandle <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 <String , byte[]>, OutputStreamSender , JSONReadHandle , JSONWriteHandle , TextReadHandle , TextWriteHandle , XMLReadHandle , XMLWriteHandle , StructureReadHandle , StructureWriteHandle , CtsQueryWriteHandle , QuadsWriteHandle , TriplesReadHandle , TriplesWriteHandle , SPARQLResultsReadHandle
A String Handle represents document content as a
string for reading or writing.
Field Summary
Constructor Summary
Constructors
Zero-argument constructor.
Initializes the handle by constructing a string
from the content of a reader.
Initializes the handle with a string for the
content.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Converts a byte serialization to the content
representation.
byte[]
Converts the content representation to
bytes.
Assigns a string constructed from the content of
a reader and returns the handle as a fluent convenience.
void
Sets the content of the handle by copying from a
byte array buffer encoded in UTF-8.
Returns the string for the content.
Returns the class of the handled content, which
may be a base class of the actual class of a content object.
Constructs an array for the handled content
representation
Creates a factory to create a StringHandle
instance for a string.
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
Constructs an uninitialized array with the
specified length with items of the same content
representation.
protected void
void
Assigns an string as the content.
byte[]
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
Converts the serialization to the content
representation.
Assigns a string as the content and returns the
handle as a fluent convenience.
Specifies the format of the content and returns
the handle as a fluent convenience.
Specifies the mime type of the content and
returns the handle as a fluent convenience.
void
Implements a callback to write content to the
provided output stream for sending to the database server.
Methods inherited from
class com.marklogic.client.impl.HandleImplementation
getPointInTimeQueryTimestamp, isResendable,
setPointInTimeQueryTimestamp, setResendable,
setResponseServerTimestamp
Constructor Details
StringHandle
public StringHandle ()
Zero-argument constructor.
StringHandle
public StringHandle (String content)
Initializes the handle with a string for the
content.
Parameters:
content - a content string
StringHandle
public StringHandle (Reader content)
Initializes the handle by constructing a string
from the content of a reader.
Parameters:
content - the reader with the content
Method Details
newFactory
Creates a factory to create a StringHandle
instance for a string.
Returns:
the factory
get
Returns the string for the content.
Specified by:
get in
interface ContentHandle <String >
Returns:
the string
set
public void set (String content)
Assigns an string as the content.
Specified by:
set in
interface ContentHandle <String >
Parameters:
content - a string
with
Assigns a string as the content and returns the
handle as a fluent convenience.
Parameters:
content - a string
Returns:
this handle
from
Assigns a string constructed from the content of
a reader and returns the handle as a fluent convenience.
Parameters:
content - the reader with the content
Returns:
this handle
getContentClass
Returns the class of the handled content, which
may be a base class of the actual class of a content object. Note
that implementations should override the default method, which
returns null if the handle doesn't have any content.
Specified by:
getContentClass in
interface ContentHandle <String >
Returns:
the class for the handled content
newHandle
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
Specified by:
newHandle in
interface BufferableContentHandle <String , byte[]>
Specified by:
newHandle in
interface ContentHandle <String >
Specified by:
newHandle in
interface ResendableContentHandle <String , byte[]>
Returns:
the new handle
newHandleArray
Constructs an uninitialized array with the
specified length with items of the same content
representation.
Specified by:
newHandleArray in
interface BufferableContentHandle <String , byte[]>
Specified by:
newHandleArray in
interface ResendableContentHandle <String , byte[]>
Parameters:
length - the number of positions in the array
Returns:
the uninitialized array
newArray
public String [] newArray (int length)
Constructs an array for the handled content
representation
Specified by:
newArray in
interface ContentHandle <String >
Parameters:
length - the size of the array (zero or more)
Returns:
the constructed array
withFormat
Specifies the format of the content and returns
the handle as a fluent convenience.
Parameters:
format - the format of the content
Returns:
this handle
withMimetype
Specifies the mime type of the content and
returns the handle as a fluent convenience.
Parameters:
mimetype - the mime type of the content
Returns:
this handle
fromBuffer
public void fromBuffer (byte[] buffer)
Sets the content of the handle by copying from a
byte array buffer encoded in UTF-8.
Specified by:
fromBuffer in
interface BufferableHandle
Parameters:
buffer - the byte array
toBuffer
public byte[] toBuffer ()
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
Specified by:
toBuffer in
interface BufferableHandle
Returns:
the byte array
bytesToContent
public String bytesToContent (byte[] buffer)
Converts a byte serialization to the content
representation.
Specified by:
bytesToContent in
interface BufferableContentHandle <String , byte[]>
Parameters:
buffer - the byte serialization
Returns:
the content representation
contentToBytes
public byte[] contentToBytes (String content)
Converts the content representation to
bytes.
Specified by:
contentToBytes in
interface BufferableContentHandle <String , byte[]>
Parameters:
content - the content
Returns:
the byte serialization of the content
toString
Returns the content.
Overrides:
toString in
class Object
toContent
public String toContent (byte[] serialization)
Converts the serialization to the content
representation.
Specified by:
toContent in
interface BufferableContentHandle <String , byte[]>
Parameters:
serialization - a serialization of the
content
Returns:
the content representation
receiveAs
protected Class <byte[]> receiveAs ()
Overrides:
receiveAs in
class com.marklogic.client.impl.HandleImplementation<byte[],OutputStreamSender >
receiveContent
protected void receiveContent (byte[] content)
Overrides:
receiveContent in
class com.marklogic.client.impl.HandleImplementation<byte[],OutputStreamSender >
sendContent
Overrides:
sendContent in
class com.marklogic.client.impl.HandleImplementation<byte[],OutputStreamSender >
write
Implements a callback to write content to the
provided output stream for sending to the database server.
Specified by:
write in
interface OutputStreamSender
Parameters:
out - the output stream receiving the content
Throws:
IOException - if io problems arise
Copyright (c) 2010-2025 Progress
Software Corporation and/or its subsidiaries or affiliates. All
Rights Reserved.