ContentDescriptor, AbstractReadHandle, AbstractWriteHandle, BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>, BufferableHandle, ContentHandle<com.google.gson.JsonElement>, DocumentMetadataReadHandle, DocumentMetadataWriteHandle, DocumentPatchHandle, JSONReadHandle, JSONWriteHandle, QueryOptionsListReadHandle, QueryOptionsReadHandle, QueryOptionsWriteHandle, ResendableContentHandle<com.google.gson.JsonElement,java.io.InputStream>, RuleListReadHandle, RuleReadHandle, RuleWriteHandle, SearchReadHandle, SPARQLResultsReadHandle, StructureReadHandle, StructureWriteHandle, TriplesReadHandle, TriplesWriteHandle, TuplesReadHandle, ValuesListReadHandle, ValuesReadHandlepublic class GSONHandle extends BaseHandle<java.io.InputStream,java.lang.String> implements ResendableContentHandle<com.google.gson.JsonElement,java.io.InputStream>, 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 |
|---|---|---|
com.google.gson.JsonElement |
bytesToContent(byte[] buffer) |
Converts a byte serialization to the content representation.
|
byte[] |
contentToBytes(com.google.gson.JsonElement content) |
Converts the content representation to bytes.
|
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.
|
java.lang.Class<com.google.gson.JsonElement> |
getContentClass() |
Returns the class of the handled content, which may be a base
class of the actual class of a content object.
|
com.google.gson.JsonParser |
getParser() |
Deprecated.
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a GSONHandle instance for a JsonElement node.
|
GSONHandle |
newHandle() |
Constructs a new handle for the same content representation,
initializing the new handle with the same format and mime type.
|
GSONHandle[] |
newHandleArray(int length) |
Constructs an uninitialized array with the specified length with items
of the same content representation.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream serialization) |
|
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.
|
com.google.gson.JsonElement |
toContent(java.io.InputStream serialization) |
Converts the serialization to the content representation.
|
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, setServerTimestampresendableHandleFornewArraygetPointInTimeQueryTimestamp, isResendable, setPointInTimeQueryTimestamp, setResendable, setResponseServerTimestampclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnewHandle, resendableHandleForpublic GSONHandle()
public GSONHandle(com.google.gson.JsonElement content)
content - the JSON root element of the tree.public static ContentHandleFactory newFactory()
public GSONHandle newHandle()
ContentHandlenewHandle in interface BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>newHandle in interface ContentHandle<com.google.gson.JsonElement>newHandle in interface ResendableContentHandle<com.google.gson.JsonElement,java.io.InputStream>public GSONHandle[] newHandleArray(int length)
BufferableContentHandlenewHandleArray in interface BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>newHandleArray in interface ResendableContentHandle<com.google.gson.JsonElement,java.io.InputStream>length - the number of positions in the arraypublic 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 java.lang.Class<com.google.gson.JsonElement> getContentClass()
ContentHandlegetContentClass in interface ContentHandle<com.google.gson.JsonElement>public void setFormat(Format format)
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<java.io.InputStream,java.lang.String>format - the format of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandlefromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic com.google.gson.JsonElement bytesToContent(byte[] buffer)
BufferableContentHandlebytesToContent in interface BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>buffer - the byte serializationpublic byte[] contentToBytes(com.google.gson.JsonElement content)
BufferableContentHandlecontentToBytes in interface BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>content - the contentpublic java.lang.String toString()
toString in class java.lang.Objectpublic com.google.gson.JsonElement toContent(java.io.InputStream serialization)
BufferableContentHandletoContent in interface BufferableContentHandle<com.google.gson.JsonElement,java.io.InputStream>serialization - a serialization of the contentprotected 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 serialization)
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-2021 MarkLogic Corporation.