Package org.apache.thrift.protocol
Class TBinaryProtocol
- java.lang.Object
-
- org.apache.thrift.protocol.TProtocol
-
- org.apache.thrift.protocol.TBinaryProtocol
-
public class TBinaryProtocol extends TProtocol
Binary protocol implementation for thrift.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TBinaryProtocol.Factory
Factory
-
Field Summary
Fields Modifier and Type Field Description protected boolean
strictRead_
protected boolean
strictWrite_
protected static int
VERSION_1
protected static int
VERSION_MASK
-
Fields inherited from class org.apache.thrift.protocol.TProtocol
skippedBytes, trans_
-
-
Constructor Summary
Constructors Constructor Description TBinaryProtocol(TTransport trans)
ConstructorTBinaryProtocol(TTransport trans, boolean strictRead, boolean strictWrite)
TBinaryProtocol(TTransport trans, long stringLengthLimit, long containerLengthLimit)
TBinaryProtocol(TTransport trans, long stringLengthLimit, long containerLengthLimit, boolean strictRead, boolean strictWrite)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMinSerializedSize(byte type)
Return the minimum number of bytes a type will consume on the wirejava.nio.ByteBuffer
readBinary()
boolean
readBool()
byte
readByte()
double
readDouble()
TField
readFieldBegin()
int
readFieldBeginData()
void
readFieldEnd()
short
readI16()
int
readI32()
long
readI64()
TList
readListBegin()
void
readListEnd()
TMap
readMapBegin()
void
readMapEnd()
TMessage
readMessageBegin()
Reading methods.void
readMessageEnd()
TSet
readSetBegin()
void
readSetEnd()
java.lang.String
readString()
java.lang.String
readStringBody(int size)
TStruct
readStructBegin()
void
readStructEnd()
protected void
skipBinary()
protected void
skipBool()
The default implementation of all skip() methods calls the corresponding read() method.protected void
skipByte()
protected void
skipDouble()
protected void
skipI16()
protected void
skipI32()
protected void
skipI64()
void
writeBinary(java.nio.ByteBuffer bin)
void
writeBool(boolean b)
void
writeByte(byte b)
void
writeDouble(double dub)
void
writeFieldBegin(TField field)
void
writeFieldEnd()
void
writeFieldStop()
void
writeI16(short i16)
void
writeI32(int i32)
void
writeI64(long i64)
void
writeListBegin(TList list)
void
writeListEnd()
void
writeMapBegin(TMap map)
void
writeMapEnd()
void
writeMessageBegin(TMessage message)
Writing methods.void
writeMessageEnd()
void
writeSetBegin(TSet set)
void
writeSetEnd()
void
writeString(java.lang.String str)
void
writeStructBegin(TStruct struct)
void
writeStructEnd()
-
Methods inherited from class org.apache.thrift.protocol.TProtocol
checkReadBytesAvailable, checkReadBytesAvailable, checkReadBytesAvailable, getScheme, getTransport, reset, skip, skip, skipBytes
-
-
-
-
Field Detail
-
VERSION_MASK
protected static final int VERSION_MASK
- See Also:
- Constant Field Values
-
VERSION_1
protected static final int VERSION_1
- See Also:
- Constant Field Values
-
strictRead_
protected boolean strictRead_
-
strictWrite_
protected boolean strictWrite_
-
-
Constructor Detail
-
TBinaryProtocol
public TBinaryProtocol(TTransport trans)
Constructor
-
TBinaryProtocol
public TBinaryProtocol(TTransport trans, boolean strictRead, boolean strictWrite)
-
TBinaryProtocol
public TBinaryProtocol(TTransport trans, long stringLengthLimit, long containerLengthLimit)
-
TBinaryProtocol
public TBinaryProtocol(TTransport trans, long stringLengthLimit, long containerLengthLimit, boolean strictRead, boolean strictWrite)
-
-
Method Detail
-
writeMessageBegin
public void writeMessageBegin(TMessage message) throws TException
Description copied from class:TProtocol
Writing methods.- Specified by:
writeMessageBegin
in classTProtocol
- Throws:
TException
-
writeMessageEnd
public void writeMessageEnd() throws TException
- Specified by:
writeMessageEnd
in classTProtocol
- Throws:
TException
-
writeStructBegin
public void writeStructBegin(TStruct struct) throws TException
- Specified by:
writeStructBegin
in classTProtocol
- Throws:
TException
-
writeStructEnd
public void writeStructEnd() throws TException
- Specified by:
writeStructEnd
in classTProtocol
- Throws:
TException
-
writeFieldBegin
public void writeFieldBegin(TField field) throws TException
- Specified by:
writeFieldBegin
in classTProtocol
- Throws:
TException
-
writeFieldEnd
public void writeFieldEnd() throws TException
- Specified by:
writeFieldEnd
in classTProtocol
- Throws:
TException
-
writeFieldStop
public void writeFieldStop() throws TException
- Specified by:
writeFieldStop
in classTProtocol
- Throws:
TException
-
writeMapBegin
public void writeMapBegin(TMap map) throws TException
- Specified by:
writeMapBegin
in classTProtocol
- Throws:
TException
-
writeMapEnd
public void writeMapEnd() throws TException
- Specified by:
writeMapEnd
in classTProtocol
- Throws:
TException
-
writeListBegin
public void writeListBegin(TList list) throws TException
- Specified by:
writeListBegin
in classTProtocol
- Throws:
TException
-
writeListEnd
public void writeListEnd() throws TException
- Specified by:
writeListEnd
in classTProtocol
- Throws:
TException
-
writeSetBegin
public void writeSetBegin(TSet set) throws TException
- Specified by:
writeSetBegin
in classTProtocol
- Throws:
TException
-
writeSetEnd
public void writeSetEnd() throws TException
- Specified by:
writeSetEnd
in classTProtocol
- Throws:
TException
-
writeBool
public void writeBool(boolean b) throws TException
- Specified by:
writeBool
in classTProtocol
- Throws:
TException
-
writeByte
public void writeByte(byte b) throws TException
- Specified by:
writeByte
in classTProtocol
- Throws:
TException
-
writeI16
public void writeI16(short i16) throws TException
- Specified by:
writeI16
in classTProtocol
- Throws:
TException
-
writeI32
public void writeI32(int i32) throws TException
- Specified by:
writeI32
in classTProtocol
- Throws:
TException
-
writeI64
public void writeI64(long i64) throws TException
- Specified by:
writeI64
in classTProtocol
- Throws:
TException
-
writeDouble
public void writeDouble(double dub) throws TException
- Specified by:
writeDouble
in classTProtocol
- Throws:
TException
-
writeString
public void writeString(java.lang.String str) throws TException
- Specified by:
writeString
in classTProtocol
- Throws:
TException
-
writeBinary
public void writeBinary(java.nio.ByteBuffer bin) throws TException
- Specified by:
writeBinary
in classTProtocol
- Throws:
TException
-
readMessageBegin
public TMessage readMessageBegin() throws TException
Reading methods.- Specified by:
readMessageBegin
in classTProtocol
- Throws:
TException
-
readMessageEnd
public void readMessageEnd() throws TException
- Specified by:
readMessageEnd
in classTProtocol
- Throws:
TException
-
readStructBegin
public TStruct readStructBegin() throws TException
- Specified by:
readStructBegin
in classTProtocol
- Throws:
TException
-
readStructEnd
public void readStructEnd() throws TException
- Specified by:
readStructEnd
in classTProtocol
- Throws:
TException
-
readFieldBegin
public TField readFieldBegin() throws TException
- Specified by:
readFieldBegin
in classTProtocol
- Throws:
TException
-
readFieldEnd
public void readFieldEnd() throws TException
- Specified by:
readFieldEnd
in classTProtocol
- Throws:
TException
-
readMapBegin
public TMap readMapBegin() throws TException
- Specified by:
readMapBegin
in classTProtocol
- Throws:
TException
-
readMapEnd
public void readMapEnd() throws TException
- Specified by:
readMapEnd
in classTProtocol
- Throws:
TException
-
readListBegin
public TList readListBegin() throws TException
- Specified by:
readListBegin
in classTProtocol
- Throws:
TException
-
readListEnd
public void readListEnd() throws TException
- Specified by:
readListEnd
in classTProtocol
- Throws:
TException
-
readSetBegin
public TSet readSetBegin() throws TException
- Specified by:
readSetBegin
in classTProtocol
- Throws:
TException
-
readSetEnd
public void readSetEnd() throws TException
- Specified by:
readSetEnd
in classTProtocol
- Throws:
TException
-
readBool
public boolean readBool() throws TException
- Specified by:
readBool
in classTProtocol
- Throws:
TException
-
readByte
public byte readByte() throws TException
- Specified by:
readByte
in classTProtocol
- Throws:
TException
-
readI16
public short readI16() throws TException
- Specified by:
readI16
in classTProtocol
- Throws:
TException
-
readI32
public int readI32() throws TException
- Specified by:
readI32
in classTProtocol
- Throws:
TException
-
readI64
public long readI64() throws TException
- Specified by:
readI64
in classTProtocol
- Throws:
TException
-
readDouble
public double readDouble() throws TException
- Specified by:
readDouble
in classTProtocol
- Throws:
TException
-
readString
public java.lang.String readString() throws TException
- Specified by:
readString
in classTProtocol
- Throws:
TException
-
readStringBody
public java.lang.String readStringBody(int size) throws TException
- Throws:
TException
-
readBinary
public java.nio.ByteBuffer readBinary() throws TException
- Specified by:
readBinary
in classTProtocol
- Throws:
TException
-
getMinSerializedSize
public int getMinSerializedSize(byte type) throws TTransportException
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:
- Throws:
TTransportException
-
readFieldBeginData
public int readFieldBeginData() throws TException
- Overrides:
readFieldBeginData
in classTProtocol
- Throws:
TException
-
skipBool
protected void skipBool() throws TException
Description copied from class:TProtocol
The default implementation of all skip() methods calls the corresponding read() method. Protocols that derive from this class are strongly encouraged to provide a more efficient alternative.- Overrides:
skipBool
in classTProtocol
- Throws:
TException
-
skipByte
protected void skipByte() throws TException
- Overrides:
skipByte
in classTProtocol
- Throws:
TException
-
skipI16
protected void skipI16() throws TException
- Overrides:
skipI16
in classTProtocol
- Throws:
TException
-
skipI32
protected void skipI32() throws TException
- Overrides:
skipI32
in classTProtocol
- Throws:
TException
-
skipI64
protected void skipI64() throws TException
- Overrides:
skipI64
in classTProtocol
- Throws:
TException
-
skipDouble
protected void skipDouble() throws TException
- Overrides:
skipDouble
in classTProtocol
- Throws:
TException
-
skipBinary
protected void skipBinary() throws TException
- Overrides:
skipBinary
in classTProtocol
- Throws:
TException
-
-