Package org.apache.thrift.protocol
Class TJSONProtocol
- java.lang.Object
-
- org.apache.thrift.protocol.TProtocol
-
- org.apache.thrift.protocol.TJSONProtocol
-
- All Implemented Interfaces:
TReadProtocol,TWriteProtocol
public class TJSONProtocol extends TProtocol
JSON protocol implementation for thrift.This is a full-featured protocol supporting write and read.
Please see the C++ class header for a detailed description of the protocol's wire format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTJSONProtocol.FactoryFactory for JSON protocol objectsprotected classTJSONProtocol.JSONBaseContextprotected classTJSONProtocol.JSONListContextprotected classTJSONProtocol.JSONPairContextprotected classTJSONProtocol.LookaheadReader-
Nested classes/interfaces inherited from class org.apache.thrift.protocol.TProtocol
TProtocol.ReadCallback<T,R>, TProtocol.ReadCollectionCallback<R>, TProtocol.ReadMapEntryCallback<K,V>, TProtocol.WriteCallback<T>
-
-
Field Summary
-
Fields inherited from class org.apache.thrift.protocol.TProtocol
skippedBytes, trans_
-
-
Constructor Summary
Constructors Constructor Description TJSONProtocol(TTransport trans)ConstructorTJSONProtocol(TTransport trans, boolean fieldNamesAsString)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMinSerializedSize(byte type)Return the minimum number of bytes a type will consume on the wirejava.nio.ByteBufferreadBinary()booleanreadBool()bytereadByte()doublereadDouble()TFieldreadFieldBegin()voidreadFieldEnd()shortreadI16()intreadI32()longreadI64()protected voidreadJSONSyntaxChar(byte[] b)TListreadListBegin()voidreadListEnd()TMapreadMapBegin()voidreadMapEnd()TMessagereadMessageBegin()voidreadMessageEnd()TSetreadSetBegin()voidreadSetEnd()java.lang.StringreadString()TStructreadStructBegin()voidreadStructEnd()voidreset()Reset any internal state back to a blank slate.voidwriteBinary(java.nio.ByteBuffer bin)voidwriteBool(boolean b)voidwriteByte(byte b)voidwriteDouble(double dub)voidwriteFieldBegin(TField field)voidwriteFieldEnd()voidwriteFieldStop()voidwriteI16(short i16)voidwriteI32(int i32)voidwriteI64(long i64)voidwriteListBegin(TList list)voidwriteListEnd()voidwriteMapBegin(TMap map)voidwriteMapEnd()voidwriteMessageBegin(TMessage message)voidwriteMessageEnd()voidwriteSetBegin(TSet set)voidwriteSetEnd()voidwriteString(java.lang.String str)voidwriteStructBegin(TStruct struct)voidwriteStructEnd()-
Methods inherited from class org.apache.thrift.protocol.TProtocol
checkReadBytesAvailable, checkReadBytesAvailable, checkReadBytesAvailable, getScheme, getTransport, readField, readFieldBeginData, readList, readList, readList, readMap, readMap, readMap, readMessage, readSet, readSet, readSet, readStruct, skip, skip, skipBinary, skipBool, skipByte, skipBytes, skipDouble, skipI16, skipI32, skipI64, writeField, writeList, writeMap, writeMessage, writeSet, writeStruct
-
-
-
-
Constructor Detail
-
TJSONProtocol
public TJSONProtocol(TTransport trans)
Constructor
-
TJSONProtocol
public TJSONProtocol(TTransport trans, boolean fieldNamesAsString)
-
-
Method Detail
-
reset
public void reset()
Description copied from class:TProtocolReset any internal state back to a blank slate. This method only needs to be implemented for stateful protocols.
-
readJSONSyntaxChar
protected void readJSONSyntaxChar(byte[] b) throws TException- Throws:
TException
-
writeMessageBegin
public void writeMessageBegin(TMessage message) throws TException
- Throws:
TException
-
writeMessageEnd
public void writeMessageEnd() throws TException- Throws:
TException
-
writeStructBegin
public void writeStructBegin(TStruct struct) throws TException
- Throws:
TException
-
writeStructEnd
public void writeStructEnd() throws TException- Throws:
TException
-
writeFieldBegin
public void writeFieldBegin(TField field) throws TException
- Throws:
TException
-
writeFieldEnd
public void writeFieldEnd() throws TException- Throws:
TException
-
writeFieldStop
public void writeFieldStop()
-
writeMapBegin
public void writeMapBegin(TMap map) throws TException
- Throws:
TException
-
writeMapEnd
public void writeMapEnd() throws TException- Throws:
TException
-
writeListBegin
public void writeListBegin(TList list) throws TException
- Throws:
TException
-
writeListEnd
public void writeListEnd() throws TException- Throws:
TException
-
writeSetBegin
public void writeSetBegin(TSet set) throws TException
- Throws:
TException
-
writeSetEnd
public void writeSetEnd() throws TException- Throws:
TException
-
writeBool
public void writeBool(boolean b) throws TException- Throws:
TException
-
writeByte
public void writeByte(byte b) throws TException- Throws:
TException
-
writeI16
public void writeI16(short i16) throws TException- Throws:
TException
-
writeI32
public void writeI32(int i32) throws TException- Throws:
TException
-
writeI64
public void writeI64(long i64) throws TException- Throws:
TException
-
writeDouble
public void writeDouble(double dub) throws TException- Throws:
TException
-
writeString
public void writeString(java.lang.String str) throws TException- Throws:
TException
-
writeBinary
public void writeBinary(java.nio.ByteBuffer bin) throws TException- Throws:
TException
-
readMessageBegin
public TMessage readMessageBegin() throws TException
- Throws:
TException
-
readMessageEnd
public void readMessageEnd() throws TException- Throws:
TException
-
readStructBegin
public TStruct readStructBegin() throws TException
- Throws:
TException
-
readStructEnd
public void readStructEnd() throws TException- Throws:
TException
-
readFieldBegin
public TField readFieldBegin() throws TException
- Throws:
TException
-
readFieldEnd
public void readFieldEnd() throws TException- Throws:
TException
-
readMapBegin
public TMap readMapBegin() throws TException
- Throws:
TException
-
readMapEnd
public void readMapEnd() throws TException- Throws:
TException
-
readListBegin
public TList readListBegin() throws TException
- Throws:
TException
-
readListEnd
public void readListEnd() throws TException- Throws:
TException
-
readSetBegin
public TSet readSetBegin() throws TException
- Throws:
TException
-
readSetEnd
public void readSetEnd() throws TException- Throws:
TException
-
readBool
public boolean readBool() throws TException- Throws:
TException
-
readByte
public byte readByte() throws TException- Throws:
TException
-
readI16
public short readI16() throws TException- Throws:
TException
-
readI32
public int readI32() throws TException- Throws:
TException
-
readI64
public long readI64() throws TException- Throws:
TException
-
readDouble
public double readDouble() throws TException- Throws:
TException
-
readString
public java.lang.String readString() throws TException- Throws:
TException
-
readBinary
public java.nio.ByteBuffer readBinary() throws TException- Throws:
TException
-
getMinSerializedSize
public int getMinSerializedSize(byte type) throws TTransportExceptionReturn the minimum number of bytes a type will consume on the wire- Specified by:
getMinSerializedSizein classTProtocol- Parameters:
type- Returns the minimum amount of bytes needed to store the smallest possible instance of TType.- Returns:
- min serialized size
- Throws:
TTransportException
-
-