Class ProtobufSerializerFactory

java.lang.Object
io.servicetalk.data.protobuf.ProtobufSerializerFactory

public final class ProtobufSerializerFactory extends Object
Caches instances of SerializerDeserializer and StreamingSerializerDeserializer for protocol buffer.

Use PROTOBUF for the default configuration, or construct an instance via ProtobufSerializerFactory(int) to bound the maximum size of streaming (VarInt length-prefixed) messages.

  • Field Details

  • Constructor Details

    • ProtobufSerializerFactory

      public ProtobufSerializerFactory(int maxMessageSize)
      Create a factory that bounds the maximum size of messages accepted by its streaming deserializers.
      Parameters:
      maxMessageSize - The maximum length (in bytes) declared by a streaming frame's length prefix that will be accepted during deserialization. A frame declaring a larger length is rejected before any of its bytes are buffered. 0 disables the limit; -1 warns at the default threshold without rejecting; other negative values are rejected. This applies only to streaming deserialization; single-message serialization is not length-prefixed and is unaffected.
  • Method Details