|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.thrift.protocol.TProtocol
org.apache.thrift.protocol.TCompactProtocol
public final class TCompactProtocol
TCompactProtocol2 is the Java implementation of the compact protocol specified in THRIFT-110. The fundamental approach to reducing the overhead of structures is a) use variable-length integers all over the place and b) make use of unused bits wherever possible. Your savings will obviously vary based on the specific makeup of your structs, but in general, the more fields, nested structures, short strings and collections, and low-value i32 and i64 fields you have, the more benefit you'll see.
| Nested Class Summary | |
|---|---|
static class |
TCompactProtocol.Factory
TProtocolFactory that produces TCompactProtocols. |
| Field Summary |
|---|
| Fields inherited from class org.apache.thrift.protocol.TProtocol |
|---|
trans_ |
| Constructor Summary | |
|---|---|
TCompactProtocol(TTransport transport)
Create a TCompactProtocol. |
|
| Method Summary | |
|---|---|
byte[] |
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 |
writeBinary(byte[] 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 preceeding. |
void |
writeStructBegin(TStruct struct)
Write a struct begin. |
void |
writeStructEnd()
Write a struct end. |
| Methods inherited from class org.apache.thrift.protocol.TProtocol |
|---|
getTransport |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TCompactProtocol(TTransport transport)
transport - the TTransport object to read from or write to.| Method Detail |
|---|
public void writeMessageBegin(TMessage message)
throws TException
writeMessageBegin in class TProtocolTException
public void writeStructBegin(TStruct struct)
throws TException
writeStructBegin in class TProtocolTException
public void writeStructEnd()
throws TException
writeStructEnd in class TProtocolTException
public void writeFieldBegin(TField field)
throws TException
writeFieldBegin in class TProtocolTException
public void writeFieldStop()
throws TException
writeFieldStop in class TProtocolTException
public void writeMapBegin(TMap map)
throws TException
writeMapBegin in class TProtocolTException
public void writeListBegin(TList list)
throws TException
writeListBegin in class TProtocolTException
public void writeSetBegin(TSet set)
throws TException
writeSetBegin in class TProtocolTException
public void writeBool(boolean b)
throws TException
writeBool in class TProtocolTException
public void writeByte(byte b)
throws TException
writeByte in class TProtocolTException
public void writeI16(short i16)
throws TException
writeI16 in class TProtocolTException
public void writeI32(int i32)
throws TException
writeI32 in class TProtocolTException
public void writeI64(long i64)
throws TException
writeI64 in class TProtocolTException
public void writeDouble(double dub)
throws TException
writeDouble in class TProtocolTException
public void writeString(java.lang.String str)
throws TException
writeString in class TProtocolTException
public void writeBinary(byte[] bin)
throws TException
writeBinary in class TProtocolTException
public void writeMessageEnd()
throws TException
writeMessageEnd in class TProtocolTException
public void writeMapEnd()
throws TException
writeMapEnd in class TProtocolTException
public void writeListEnd()
throws TException
writeListEnd in class TProtocolTException
public void writeSetEnd()
throws TException
writeSetEnd in class TProtocolTException
public void writeFieldEnd()
throws TException
writeFieldEnd in class TProtocolTException
protected void writeCollectionBegin(byte elemType,
int size)
throws TException
TException
public TMessage readMessageBegin()
throws TException
readMessageBegin in class TProtocolTException
public TStruct readStructBegin()
throws TException
readStructBegin in class TProtocolTException
public void readStructEnd()
throws TException
readStructEnd in class TProtocolTException
public TField readFieldBegin()
throws TException
readFieldBegin in class TProtocolTException
public TMap readMapBegin()
throws TException
readMapBegin in class TProtocolTException
public TList readListBegin()
throws TException
readListBegin in class TProtocolTException
public TSet readSetBegin()
throws TException
readSetBegin in class TProtocolTException
public boolean readBool()
throws TException
readBool in class TProtocolTException
public byte readByte()
throws TException
readByte in class TProtocolTException
public short readI16()
throws TException
readI16 in class TProtocolTException
public int readI32()
throws TException
readI32 in class TProtocolTException
public long readI64()
throws TException
readI64 in class TProtocolTException
public double readDouble()
throws TException
readDouble in class TProtocolTException
public java.lang.String readString()
throws TException
readString in class TProtocolTException
public byte[] readBinary()
throws TException
readBinary in class TProtocolTException
public void readMessageEnd()
throws TException
readMessageEnd in class TProtocolTException
public void readFieldEnd()
throws TException
readFieldEnd in class TProtocolTException
public void readMapEnd()
throws TException
readMapEnd in class TProtocolTException
public void readListEnd()
throws TException
readListEnd in class TProtocolTException
public void readSetEnd()
throws TException
readSetEnd in class TProtocolTException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||