public class StringHandle extends BaseHandle<byte[],OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<java.lang.String>, JSONReadHandle, JSONWriteHandle, TextReadHandle, TextWriteHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, QuadsWriteHandle, TriplesReadHandle, TriplesWriteHandle, SPARQLResultsReadHandle
UNKNOWN_LENGTH
Constructor and Description |
---|
StringHandle()
Zero-argument constructor.
|
StringHandle(java.lang.String content)
Initializes the handle with a string for the content.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static ContentHandleFactory |
newFactory()
Creates a factory to create a StringHandle instance for a string.
|
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 |
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
public StringHandle()
public StringHandle(java.lang.String content)
content
- a content stringpublic 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 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 toString()
toString
in class java.lang.Object
protected 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 © 2013-2018 MarkLogic Corporation.