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 classTBinaryProtocol.FactoryFactory
-
Field Summary
Fields Modifier and Type Field Description protected booleanstrictRead_protected booleanstrictWrite_protected static intVERSION_1protected static intVERSION_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 intgetMinSerializedSize(byte type)Return the minimum number of bytes a type will consume on the wirejava.nio.ByteBufferreadBinary()booleanreadBool()bytereadByte()doublereadDouble()TFieldreadFieldBegin()intreadFieldBeginData()voidreadFieldEnd()shortreadI16()intreadI32()longreadI64()TListreadListBegin()voidreadListEnd()TMapreadMapBegin()voidreadMapEnd()TMessagereadMessageBegin()Reading methods.voidreadMessageEnd()TSetreadSetBegin()voidreadSetEnd()java.lang.StringreadString()java.lang.StringreadStringBody(int size)TStructreadStructBegin()voidreadStructEnd()protected voidskipBinary()protected voidskipBool()The default implementation of all skip() methods calls the corresponding read() method.protected voidskipByte()protected voidskipDouble()protected voidskipI16()protected voidskipI32()protected voidskipI64()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)Writing methods.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, 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:TProtocolWriting methods.- Specified by:
writeMessageBeginin classTProtocol- Throws:
TException
-
writeMessageEnd
public void writeMessageEnd() throws TException- Specified by:
writeMessageEndin classTProtocol- Throws:
TException
-
writeStructBegin
public void writeStructBegin(TStruct struct) throws TException
- Specified by:
writeStructBeginin classTProtocol- Throws:
TException
-
writeStructEnd
public void writeStructEnd() throws TException- Specified by:
writeStructEndin classTProtocol- Throws:
TException
-
writeFieldBegin
public void writeFieldBegin(TField field) throws TException
- Specified by:
writeFieldBeginin classTProtocol- Throws:
TException
-
writeFieldEnd
public void writeFieldEnd() throws TException- Specified by:
writeFieldEndin classTProtocol- Throws:
TException
-
writeFieldStop
public void writeFieldStop() throws TException- Specified by:
writeFieldStopin classTProtocol- Throws:
TException
-
writeMapBegin
public void writeMapBegin(TMap map) throws TException
- Specified by:
writeMapBeginin classTProtocol- Throws:
TException
-
writeMapEnd
public void writeMapEnd() throws TException- Specified by:
writeMapEndin classTProtocol- Throws:
TException
-
writeListBegin
public void writeListBegin(TList list) throws TException
- Specified by:
writeListBeginin classTProtocol- Throws:
TException
-
writeListEnd
public void writeListEnd() throws TException- Specified by:
writeListEndin classTProtocol- Throws:
TException
-
writeSetBegin
public void writeSetBegin(TSet set) throws TException
- Specified by:
writeSetBeginin classTProtocol- Throws:
TException
-
writeSetEnd
public void writeSetEnd() throws TException- Specified by:
writeSetEndin classTProtocol- Throws:
TException
-
writeBool
public void writeBool(boolean b) throws TException- Specified by:
writeBoolin classTProtocol- Throws:
TException
-
writeByte
public void writeByte(byte b) throws TException- Specified by:
writeBytein classTProtocol- Throws:
TException
-
writeI16
public void writeI16(short i16) throws TException- Specified by:
writeI16in classTProtocol- Throws:
TException
-
writeI32
public void writeI32(int i32) throws TException- Specified by:
writeI32in classTProtocol- Throws:
TException
-
writeI64
public void writeI64(long i64) throws TException- Specified by:
writeI64in classTProtocol- Throws:
TException
-
writeDouble
public void writeDouble(double dub) throws TException- Specified by:
writeDoublein classTProtocol- Throws:
TException
-
writeString
public void writeString(java.lang.String str) throws TException- Specified by:
writeStringin classTProtocol- Throws:
TException
-
writeBinary
public void writeBinary(java.nio.ByteBuffer bin) throws TException- Specified by:
writeBinaryin classTProtocol- Throws:
TException
-
readMessageBegin
public TMessage readMessageBegin() throws TException
Reading methods.- Specified by:
readMessageBeginin classTProtocol- Throws:
TException
-
readMessageEnd
public void readMessageEnd() throws TException- Specified by:
readMessageEndin classTProtocol- Throws:
TException
-
readStructBegin
public TStruct readStructBegin() throws TException
- Specified by:
readStructBeginin classTProtocol- Throws:
TException
-
readStructEnd
public void readStructEnd() throws TException- Specified by:
readStructEndin classTProtocol- Throws:
TException
-
readFieldBegin
public TField readFieldBegin() throws TException
- Specified by:
readFieldBeginin classTProtocol- Throws:
TException
-
readFieldEnd
public void readFieldEnd() throws TException- Specified by:
readFieldEndin classTProtocol- Throws:
TException
-
readMapBegin
public TMap readMapBegin() throws TException
- Specified by:
readMapBeginin classTProtocol- Throws:
TException
-
readMapEnd
public void readMapEnd() throws TException- Specified by:
readMapEndin classTProtocol- Throws:
TException
-
readListBegin
public TList readListBegin() throws TException
- Specified by:
readListBeginin classTProtocol- Throws:
TException
-
readListEnd
public void readListEnd() throws TException- Specified by:
readListEndin classTProtocol- Throws:
TException
-
readSetBegin
public TSet readSetBegin() throws TException
- Specified by:
readSetBeginin classTProtocol- Throws:
TException
-
readSetEnd
public void readSetEnd() throws TException- Specified by:
readSetEndin classTProtocol- Throws:
TException
-
readBool
public boolean readBool() throws TException- Specified by:
readBoolin classTProtocol- Throws:
TException
-
readByte
public byte readByte() throws TException- Specified by:
readBytein classTProtocol- Throws:
TException
-
readI16
public short readI16() throws TException- Specified by:
readI16in classTProtocol- Throws:
TException
-
readI32
public int readI32() throws TException- Specified by:
readI32in classTProtocol- Throws:
TException
-
readI64
public long readI64() throws TException- Specified by:
readI64in classTProtocol- Throws:
TException
-
readDouble
public double readDouble() throws TException- Specified by:
readDoublein classTProtocol- Throws:
TException
-
readString
public java.lang.String readString() throws TException- Specified by:
readStringin 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:
readBinaryin classTProtocol- 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:
- Throws:
TTransportException
-
readFieldBeginData
public int readFieldBeginData() throws TException- Overrides:
readFieldBeginDatain classTProtocol- Throws:
TException
-
skipBool
protected void skipBool() throws TExceptionDescription copied from class:TProtocolThe 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:
skipBoolin classTProtocol- Throws:
TException
-
skipByte
protected void skipByte() throws TException- Overrides:
skipBytein classTProtocol- Throws:
TException
-
skipI16
protected void skipI16() throws TException- Overrides:
skipI16in classTProtocol- Throws:
TException
-
skipI32
protected void skipI32() throws TException- Overrides:
skipI32in classTProtocol- Throws:
TException
-
skipI64
protected void skipI64() throws TException- Overrides:
skipI64in classTProtocol- Throws:
TException
-
skipDouble
protected void skipDouble() throws TException- Overrides:
skipDoublein classTProtocol- Throws:
TException
-
skipBinary
protected void skipBinary() throws TException- Overrides:
skipBinaryin classTProtocol- Throws:
TException
-
-