public class ThriftCodec
extends java.lang.Object
| Constructor and Description |
|---|
ThriftCodec() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
b64encodeJson(org.json.JSONObject thriftJson)
Return Base64 representation of binary protocol Thrift message for given Thrift JSON object.
|
org.json.JSONObject |
decode(byte[] binaryBuffer) |
static org.json.JSONObject |
decodeB64String(java.lang.String input)
Pass Base64 encoded Thrift binary protocol message through to decoder.
|
byte[] |
encode(org.json.JSONObject thriftJson)
Encode a Thrift JSON object into a binary protocol buffer.
|
protected org.apache.thrift.protocol.TProtocol |
getThriftProtocol() |
protected org.apache.thrift.transport.TTransport |
getThriftTransport() |
protected org.json.JSONArray |
readFields()
Read an array of fields out of a Thrift protocol handler.
|
protected java.lang.Object |
readFieldValue(byte fieldType)
Returns the next field value from the protocol handler based on the given type.
|
protected org.json.JSONObject |
readList()
Read out a list from the protocol.
|
protected org.json.JSONObject |
readMap()
Read out a map from the protocol.
|
protected org.json.JSONObject |
readMessage() |
protected org.json.JSONObject |
readSet()
Read out a set from the protocol
|
protected org.json.JSONArray |
readStruct() |
protected void |
setThriftProtocol(org.apache.thrift.protocol.TProtocol thriftProtocol) |
protected void |
writeFields(org.json.JSONArray fields)
Write an array of JSON field values to the Thrift protocol handler.
|
protected void |
writeFieldValue(byte fieldType,
java.lang.Object value)
Write a field value to the protocol handler.
|
protected void |
writeList(org.json.JSONObject listJson)
Write a list to the protocol.
|
protected void |
writeMap(org.json.JSONObject mapJson)
Write a map to the protocol handler.
|
protected void |
writeMessage(org.json.JSONObject msgJson) |
protected void |
writeSet(org.json.JSONObject setJson)
Write a set to the protocol
|
protected void |
writeStruct(org.json.JSONArray structJson) |
protected org.apache.thrift.transport.TTransport getThriftTransport()
protected org.apache.thrift.protocol.TProtocol getThriftProtocol()
protected void setThriftProtocol(org.apache.thrift.protocol.TProtocol thriftProtocol)
protected java.lang.Object readFieldValue(byte fieldType)
throws org.apache.thrift.TException
fieldType - TType constant type identifierorg.apache.thrift.TExceptionprotected void writeFieldValue(byte fieldType,
java.lang.Object value)
throws org.apache.thrift.TException
fieldType - TType constant type ID corresponding to the field typevalue - The field value to writeorg.apache.thrift.TExceptionprotected org.json.JSONArray readFields()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeFields(org.json.JSONArray fields)
throws org.apache.thrift.TException
fields - The JSON array of field values to write.org.apache.thrift.TExceptionprotected org.json.JSONObject readMap()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeMap(org.json.JSONObject mapJson)
throws org.apache.thrift.TException
mapJson - JSON object representing the map to write.org.apache.thrift.TExceptionprotected org.json.JSONObject readList()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeList(org.json.JSONObject listJson)
throws org.apache.thrift.TException
listJson - A JSON object containing the list's element type and an array of the list's elements.org.apache.thrift.TExceptionprotected org.json.JSONObject readSet()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeSet(org.json.JSONObject setJson)
throws org.apache.thrift.TException
setJson - A JSON object containing the set's element type and an array of the set's elements.org.apache.thrift.TExceptionprotected org.json.JSONArray readStruct()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeStruct(org.json.JSONArray structJson)
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected org.json.JSONObject readMessage()
throws org.apache.thrift.TException
org.apache.thrift.TExceptionprotected void writeMessage(org.json.JSONObject msgJson)
throws org.apache.thrift.TException
org.apache.thrift.TExceptionpublic org.json.JSONObject decode(byte[] binaryBuffer)
throws org.apache.thrift.TException,
org.json.JSONException
org.apache.thrift.TExceptionorg.json.JSONExceptionpublic byte[] encode(org.json.JSONObject thriftJson)
throws org.apache.thrift.TException,
org.json.JSONException
org.apache.thrift.TExceptionorg.json.JSONExceptionpublic static org.json.JSONObject decodeB64String(java.lang.String input)
throws org.apache.thrift.TException,
org.json.JSONException
org.apache.thrift.TExceptionorg.json.JSONExceptionpublic static java.lang.String b64encodeJson(org.json.JSONObject thriftJson)
throws org.apache.thrift.TException,
org.json.JSONException
org.apache.thrift.TExceptionorg.json.JSONException