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
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 ClassesModifier and TypeClassDescriptionstatic classFactory for JSON protocol objectsprotected static classprotected classprotected classprotected classNested 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
ConstructorsConstructorDescriptionTJSONProtocol(TTransport trans) ConstructorTJSONProtocol(TTransport trans, boolean fieldNamesAsString) -
Method Summary
Modifier and TypeMethodDescriptionintgetMinSerializedSize(byte type) Return the minimum number of bytes a type will consume on the wirebooleanreadBool()bytereadByte()doublevoidshortreadI16()intreadI32()longreadI64()protected voidreadJSONSyntaxChar(byte[] b) voidvoidvoidvoidvoidreadUuid()voidreset()Reset any internal state back to a blank slate.voidwriteBinary(ByteBuffer bin) voidwriteBool(boolean b) voidwriteByte(byte b) voidwriteDouble(double dub) voidwriteFieldBegin(TField field) voidvoidvoidwriteI16(short i16) voidwriteI32(int i32) voidwriteI64(long i64) voidwriteListBegin(TList list) voidvoidwriteMapBegin(TMap map) voidvoidwriteMessageBegin(TMessage message) voidvoidwriteSetBegin(TSet set) voidvoidwriteString(String str) voidwriteStructBegin(TStruct struct) voidvoidMethods 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 Details
-
TJSONProtocol
Constructor -
TJSONProtocol
-
-
Method Details
-
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
- Throws:
TException
-
writeMessageBegin
- Throws:
TException
-
writeMessageEnd
- Throws:
TException
-
writeStructBegin
- Throws:
TException
-
writeStructEnd
- Throws:
TException
-
writeFieldBegin
- Throws:
TException
-
writeFieldEnd
- Throws:
TException
-
writeFieldStop
public void writeFieldStop() -
writeMapBegin
- Throws:
TException
-
writeMapEnd
- Throws:
TException
-
writeListBegin
- Throws:
TException
-
writeListEnd
- Throws:
TException
-
writeSetBegin
- Throws:
TException
-
writeSetEnd
- Throws:
TException
-
writeBool
- Throws:
TException
-
writeByte
- Throws:
TException
-
writeI16
- Throws:
TException
-
writeI32
- Throws:
TException
-
writeI64
- Throws:
TException
-
writeUuid
- Throws:
TException
-
writeDouble
- Throws:
TException
-
writeString
- Throws:
TException
-
writeBinary
- Throws:
TException
-
readMessageBegin
- Throws:
TException
-
readMessageEnd
- Throws:
TException
-
readStructBegin
- Throws:
TException
-
readStructEnd
- Throws:
TException
-
readFieldBegin
- Throws:
TException
-
readFieldEnd
- Throws:
TException
-
readMapBegin
- Throws:
TException
-
readMapEnd
- Throws:
TException
-
readListBegin
- Throws:
TException
-
readListEnd
- Throws:
TException
-
readSetBegin
- Throws:
TException
-
readSetEnd
- Throws:
TException
-
readBool
- Throws:
TException
-
readByte
- Throws:
TException
-
readI16
- Throws:
TException
-
readI32
- Throws:
TException
-
readI64
- Throws:
TException
-
readUuid
- Throws:
TException
-
readDouble
- Throws:
TException
-
readString
- Throws:
TException
-
readBinary
- Throws:
TException
-
getMinSerializedSize
Return 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
-