ContentDescriptor
,
AbstractReadHandle
,
AbstractWriteHandle
,
BufferableHandle
,
ContentHandle<com.google.gson.JsonElement>
,
DocumentMetadataReadHandle
,
DocumentMetadataWriteHandle
,
DocumentPatchHandle
,
JSONReadHandle
,
JSONWriteHandle
,
QueryOptionsListReadHandle
,
QueryOptionsReadHandle
,
QueryOptionsWriteHandle
,
RuleListReadHandle
,
RuleReadHandle
,
RuleWriteHandle
,
SearchReadHandle
,
SPARQLResultsReadHandle
,
StructureReadHandle
,
StructureWriteHandle
,
TriplesReadHandle
,
TriplesWriteHandle
,
TuplesReadHandle
,
ValuesListReadHandle
,
ValuesReadHandle
public class GSONHandle extends BaseHandle<java.io.InputStream,java.lang.String> implements BufferableHandle, ContentHandle<com.google.gson.JsonElement>, JSONReadHandle, JSONWriteHandle, StructureReadHandle, StructureWriteHandle
UNKNOWN_LENGTH
Constructor | Description |
---|---|
GSONHandle() |
Zero-argument constructor.
|
GSONHandle(com.google.gson.JsonElement content) |
Provides a handle on JSON content as a
tree.
|
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.
|
com.google.gson.JsonElement |
get() |
Returns the root node of the JSON tree.
|
com.google.gson.JsonParser |
getParser() |
Returns the parser used to construct element
objects from JSON.
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a GSONHandle
instance for a JsonElement node.
|
protected
java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream content) |
|
protected java.lang.String |
sendContent() |
|
void |
set(com.google.gson.JsonElement content) |
Assigns a JSON tree as the content.
|
void |
setFormat(Format format) |
Restricts the format to JSON.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
|
java.lang.String |
toString() |
Returns the JSON tree as a string.
|
GSONHandle |
with(com.google.gson.JsonElement content) |
Assigns a JSON tree as the content and returns
the handle.
|
getByteLength,
getFormat,
getMimetype,
getServerTimestamp,
setByteLength,
setMimetype,
setServerTimestamp
getContentClass
public GSONHandle()
public GSONHandle(com.google.gson.JsonElement content)
content
- the JSON root element of the tree.public static ContentHandleFactory newFactory()
public com.google.gson.JsonParser getParser()
public com.google.gson.JsonElement get()
get
in interface ContentHandle<com.google.gson.JsonElement>
public void set(com.google.gson.JsonElement content)
set
in interface ContentHandle<com.google.gson.JsonElement>
content
- the JSON root element.public GSONHandle with(com.google.gson.JsonElement content)
content
- the JSON root element.public void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<java.io.InputStream,java.lang.String>
format
- the format 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<java.io.InputStream> receiveAs()
receiveAs
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.lang.String>
protected void receiveContent(java.io.InputStream content)
receiveContent
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.lang.String>
protected java.lang.String sendContent()
sendContent
in
class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,java.lang.String>
Copyright © 2013-2019 MarkLogic Corporation.