Class ThriftProtocolFactories

java.lang.Object
com.linecorp.armeria.common.thrift.ThriftProtocolFactories

public final class ThriftProtocolFactories extends Object
Provides a set of well-known TProtocolFactorys.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.thrift.protocol.TProtocolFactory
    Deprecated.
    Use binary(int, int) instead.
    static final org.apache.thrift.protocol.TProtocolFactory
    Deprecated.
    static final org.apache.thrift.protocol.TProtocolFactory
    Deprecated.
    Use json().
    static final org.apache.thrift.protocol.TProtocolFactory
    Deprecated.
    Use text().
    static final org.apache.thrift.protocol.TProtocolFactory
    Deprecated.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.thrift.protocol.TProtocolFactory
    binary(int maxStringLength, int maxContainerLength)
    Returns a TProtocolFactory for Thrift TBinary protocol.
    static org.apache.thrift.protocol.TProtocolFactory
    compact(int maxStringLength, int maxContainerLength)
    Returns a TProtocolFactory for Thrift TCompact protocol.
    static org.apache.thrift.protocol.TProtocolFactory
    get(SerializationFormat serializationFormat)
    static org.apache.thrift.protocol.TProtocolFactory
    Returns a TProtocolFactory for the Thrift TJSON protocol.
    static org.apache.thrift.protocol.TProtocolFactory
    Returns a TProtocolFactory for the Thrift TText protocol.
    static org.apache.thrift.protocol.TProtocolFactory
    Returns a TProtocolFactory for the Thrift TText protocol with named enums.
    toSerializationFormat(org.apache.thrift.protocol.TProtocolFactory protoFactory)
    Deprecated.
    This method has been deprecated without a replacement since it cannot reliably work with custom protocol factories.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BINARY

      @Deprecated public static final org.apache.thrift.protocol.TProtocolFactory BINARY
      Deprecated.
      Use binary(int, int) instead.
      TProtocolFactory for Thrift TBinary protocol.

      Note that this Thrift TBinary protocol does not limit the maximum number of bytes to read from the transport. Therefore, it is recommended NOT to use this factory in a public network. If an attacker sends a header with a large message size, an `OutOfMemoryError` may occur. Related: Add string/collection length limit checks (from C++) to java protocol readers

    • COMPACT

      @Deprecated public static final org.apache.thrift.protocol.TProtocolFactory COMPACT
      Deprecated.
      TProtocolFactory for Thrift TCompact protocol.

      Note that this Thrift TCompact protocol does not limit the maximum number of bytes to read from the transport. Therefore, it is recommended to NOT use this factory in a public network. If an attacker sends a header with a large message size, an `OutOfMemoryError` may occur. Related: Add string/collection length limit checks (from C++) to java protocol readers

    • JSON

      @Deprecated public static final org.apache.thrift.protocol.TProtocolFactory JSON
      Deprecated.
      Use json().
      TProtocolFactory for the Thrift TJSON protocol.
    • TEXT

      @Deprecated public static final org.apache.thrift.protocol.TProtocolFactory TEXT
      Deprecated.
      Use text().
      TProtocolFactory for the Thrift TText protocol.
    • TEXT_NAMED_ENUM

      @Deprecated public static final org.apache.thrift.protocol.TProtocolFactory TEXT_NAMED_ENUM
      Deprecated.
      TProtocolFactory for the Thrift TText protocol with named enums.
  • Method Details

    • get

      @Deprecated public static org.apache.thrift.protocol.TProtocolFactory get(SerializationFormat serializationFormat)
      Parameters:
      serializationFormat - a known serialization format
      Returns:
      the protocol factory linked to the input serializationFormat
    • binary

      public static org.apache.thrift.protocol.TProtocolFactory binary(int maxStringLength, int maxContainerLength)
      Returns a TProtocolFactory for Thrift TBinary protocol.
      Parameters:
      maxStringLength - the maximum allowed number of bytes to read from the transport for variable-length fields (such as strings or binary). 0 means unlimited.
      maxContainerLength - the maximum allowed number of containers to read from the transport for maps, sets and lists. 0 means unlimited.
    • compact

      public static org.apache.thrift.protocol.TProtocolFactory compact(int maxStringLength, int maxContainerLength)
      Returns a TProtocolFactory for Thrift TCompact protocol.
      Parameters:
      maxStringLength - the maximum allowed number of bytes to read from the transport for variable-length fields (such as strings or binary). 0 means unlimited.
      maxContainerLength - the maximum allowed number of containers to read from the transport for maps, sets and lists. 0 means unlimited.
    • json

      public static org.apache.thrift.protocol.TProtocolFactory json()
      Returns a TProtocolFactory for the Thrift TJSON protocol.
    • text

      public static org.apache.thrift.protocol.TProtocolFactory text()
      Returns a TProtocolFactory for the Thrift TText protocol.
    • textNamedEnum

      public static org.apache.thrift.protocol.TProtocolFactory textNamedEnum()
      Returns a TProtocolFactory for the Thrift TText protocol with named enums.
    • toSerializationFormat

      @Deprecated public static SerializationFormat toSerializationFormat(org.apache.thrift.protocol.TProtocolFactory protoFactory)
      Deprecated.
      This method has been deprecated without a replacement since it cannot reliably work with custom protocol factories.
      Returns the SerializationFormat for the specified TProtocolFactory, as if it were registered by DefaultThriftProtocolFactoryProvider. Consider having your own TProtocolFactory to SerializationFormat mapping if necessary.
      Throws:
      IllegalArgumentException - if the specified TProtocolFactory did not match anything