Class TCompactProtocol

  • Direct Known Subclasses:
    TTupleProtocol

    public class TCompactProtocol
    extends TProtocol
    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.
    • Constructor Detail

      • TCompactProtocol

        public TCompactProtocol​(TTransport transport,
                                long stringLengthLimit,
                                long containerLengthLimit)
        Create a TCompactProtocol.
        Parameters:
        transport - the TTransport object to read from or write to.
        stringLengthLimit - the maximum number of bytes to read for variable-length fields.
        containerLengthLimit - the maximum number of elements to read for containers.
      • TCompactProtocol

        @Deprecated
        public TCompactProtocol​(TTransport transport,
                                long stringLengthLimit)
        Deprecated.
        Use constructor specifying both string limit and container limit instead
        Create a TCompactProtocol.
        Parameters:
        transport - the TTransport object to read from or write to.
        stringLengthLimit - the maximum number of bytes to read for variable-length fields.
      • TCompactProtocol

        public TCompactProtocol​(TTransport transport)
        Create a TCompactProtocol.
        Parameters:
        transport - the TTransport object to read from or write to.