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
Modifier and TypeClassDescriptionstatic class
Factory for JSON protocol objectsprotected static class
protected class
protected class
protected class
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
ConstructorDescriptionTJSONProtocol
(TTransport trans) ConstructorTJSONProtocol
(TTransport trans, boolean fieldNamesAsString) -
Method Summary
Modifier and TypeMethodDescriptionint
getMinSerializedSize
(byte type) Return the minimum number of bytes a type will consume on the wireboolean
readBool()
byte
readByte()
double
void
short
readI16()
int
readI32()
long
readI64()
protected void
readJSONSyntaxChar
(byte[] b) void
void
void
void
void
readUuid()
void
reset()
Reset any internal state back to a blank slate.void
writeBinary
(ByteBuffer bin) void
writeBool
(boolean b) void
writeByte
(byte b) void
writeDouble
(double dub) void
writeFieldBegin
(TField field) void
void
void
writeI16
(short i16) void
writeI32
(int i32) void
writeI64
(long i64) void
writeListBegin
(TList list) void
void
writeMapBegin
(TMap map) void
void
writeMessageBegin
(TMessage message) void
void
writeSetBegin
(TSet set) void
void
writeString
(String str) void
writeStructBegin
(TStruct struct) void
void
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 Details
-
TJSONProtocol
Constructor -
TJSONProtocol
-
-
Method Details
-
reset
public void reset()Description copied from class:TProtocol
Reset 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:
getMinSerializedSize
in classTProtocol
- Parameters:
type
- Returns the minimum amount of bytes needed to store the smallest possible instance of TType.- Returns:
- min serialized size
- Throws:
TTransportException
-