public class TCompactProtocol extends TProtocol
Modifier and Type | Class and Description |
---|---|
static class |
TCompactProtocol.Factory
TProtocolFactory that produces TCompactProtocols.
|
Constructor and Description |
---|
TCompactProtocol(TTransport transport)
Create a TCompactProtocol.
|
TCompactProtocol(TTransport transport,
long maxNetworkBytes)
Create a TCompactProtocol.
|
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
readBinary()
Read a byte[] from the wire.
|
boolean |
readBool()
Read a boolean off the wire.
|
byte |
readByte()
Read a single byte off the wire.
|
double |
readDouble()
No magic here - just read a double off the wire.
|
TField |
readFieldBegin()
Read a field header off the wire.
|
void |
readFieldEnd() |
short |
readI16()
Read an i16 from the wire as a zigzag varint.
|
int |
readI32()
Read an i32 from the wire as a zigzag varint.
|
long |
readI64()
Read an i64 from the wire as a zigzag varint.
|
TList |
readListBegin()
Read a list header off the wire.
|
void |
readListEnd() |
TMap |
readMapBegin()
Read a map header off the wire.
|
void |
readMapEnd() |
TMessage |
readMessageBegin()
Read a message header.
|
void |
readMessageEnd() |
TSet |
readSetBegin()
Read a set header off the wire.
|
void |
readSetEnd() |
java.lang.String |
readString()
Reads a byte[] (via readBinary), and then UTF-8 decodes it.
|
TStruct |
readStructBegin()
Read a struct begin.
|
void |
readStructEnd()
Doesn't actually consume any wire data, just removes the last field for
this struct from the field stack.
|
void |
reset()
Reset any internal state back to a blank slate.
|
void |
writeBinary(java.nio.ByteBuffer bin)
Write a byte array, using a varint for the size.
|
void |
writeBool(boolean b)
Write a boolean value.
|
void |
writeByte(byte b)
Write a byte.
|
protected void |
writeCollectionBegin(byte elemType,
int size)
Abstract method for writing the start of lists and sets.
|
void |
writeDouble(double dub)
Write a double to the wire as 8 bytes.
|
void |
writeFieldBegin(TField field)
Write a field header containing the field id and field type.
|
void |
writeFieldEnd() |
void |
writeFieldStop()
Write the STOP symbol so we know there are no more fields in this struct.
|
void |
writeI16(short i16)
Write an I16 as a zigzag varint.
|
void |
writeI32(int i32)
Write an i32 as a zigzag varint.
|
void |
writeI64(long i64)
Write an i64 as a zigzag varint.
|
void |
writeListBegin(TList list)
Write a list header.
|
void |
writeListEnd() |
void |
writeMapBegin(TMap map)
Write a map header.
|
void |
writeMapEnd() |
void |
writeMessageBegin(TMessage message)
Write a message header to the wire.
|
void |
writeMessageEnd() |
void |
writeSetBegin(TSet set)
Write a set header.
|
void |
writeSetEnd() |
void |
writeString(java.lang.String str)
Write a string to the wire with a varint size preceding.
|
void |
writeStructBegin(TStruct struct)
Write a struct begin.
|
void |
writeStructEnd()
Write a struct end.
|
getScheme, getTransport
public TCompactProtocol(TTransport transport, long maxNetworkBytes)
transport
- the TTransport object to read from or write to.maxNetworkBytes
- the maximum number of bytes to read for
variable-length fields.public TCompactProtocol(TTransport transport)
transport
- the TTransport object to read from or write to.public void reset()
TProtocol
public void writeMessageBegin(TMessage message) throws TException
writeMessageBegin
in class TProtocol
TException
public void writeStructBegin(TStruct struct) throws TException
writeStructBegin
in class TProtocol
TException
public void writeStructEnd() throws TException
writeStructEnd
in class TProtocol
TException
public void writeFieldBegin(TField field) throws TException
writeFieldBegin
in class TProtocol
TException
public void writeFieldStop() throws TException
writeFieldStop
in class TProtocol
TException
public void writeMapBegin(TMap map) throws TException
writeMapBegin
in class TProtocol
TException
public void writeListBegin(TList list) throws TException
writeListBegin
in class TProtocol
TException
public void writeSetBegin(TSet set) throws TException
writeSetBegin
in class TProtocol
TException
public void writeBool(boolean b) throws TException
writeBool
in class TProtocol
TException
public void writeByte(byte b) throws TException
writeByte
in class TProtocol
TException
public void writeI16(short i16) throws TException
writeI16
in class TProtocol
TException
public void writeI32(int i32) throws TException
writeI32
in class TProtocol
TException
public void writeI64(long i64) throws TException
writeI64
in class TProtocol
TException
public void writeDouble(double dub) throws TException
writeDouble
in class TProtocol
TException
public void writeString(java.lang.String str) throws TException
writeString
in class TProtocol
TException
public void writeBinary(java.nio.ByteBuffer bin) throws TException
writeBinary
in class TProtocol
TException
public void writeMessageEnd() throws TException
writeMessageEnd
in class TProtocol
TException
public void writeMapEnd() throws TException
writeMapEnd
in class TProtocol
TException
public void writeListEnd() throws TException
writeListEnd
in class TProtocol
TException
public void writeSetEnd() throws TException
writeSetEnd
in class TProtocol
TException
public void writeFieldEnd() throws TException
writeFieldEnd
in class TProtocol
TException
protected void writeCollectionBegin(byte elemType, int size) throws TException
TException
public TMessage readMessageBegin() throws TException
readMessageBegin
in class TProtocol
TException
public TStruct readStructBegin() throws TException
readStructBegin
in class TProtocol
TException
public void readStructEnd() throws TException
readStructEnd
in class TProtocol
TException
public TField readFieldBegin() throws TException
readFieldBegin
in class TProtocol
TException
public TMap readMapBegin() throws TException
readMapBegin
in class TProtocol
TException
public TList readListBegin() throws TException
readListBegin
in class TProtocol
TException
public TSet readSetBegin() throws TException
readSetBegin
in class TProtocol
TException
public boolean readBool() throws TException
readBool
in class TProtocol
TException
public byte readByte() throws TException
readByte
in class TProtocol
TException
public short readI16() throws TException
readI16
in class TProtocol
TException
public int readI32() throws TException
readI32
in class TProtocol
TException
public long readI64() throws TException
readI64
in class TProtocol
TException
public double readDouble() throws TException
readDouble
in class TProtocol
TException
public java.lang.String readString() throws TException
readString
in class TProtocol
TException
public java.nio.ByteBuffer readBinary() throws TException
readBinary
in class TProtocol
TException
public void readMessageEnd() throws TException
readMessageEnd
in class TProtocol
TException
public void readFieldEnd() throws TException
readFieldEnd
in class TProtocol
TException
public void readMapEnd() throws TException
readMapEnd
in class TProtocol
TException
public void readListEnd() throws TException
readListEnd
in class TProtocol
TException
public void readSetEnd() throws TException
readSetEnd
in class TProtocol
TException