Class CompatibleObjectEncoder

  • All Implemented Interfaces:
    io.netty5.channel.ChannelHandler

    public class CompatibleObjectEncoder
    extends io.netty5.handler.codec.MessageToByteEncoder<Serializable>
    An encoder which serializes a Java object into a Buffer (interoperability version).

    This encoder is interoperable with the standard Java object streams such as ObjectInputStream and ObjectOutputStream.

    • Constructor Detail

      • CompatibleObjectEncoder

        public CompatibleObjectEncoder()
        Creates a new instance with the reset interval of 16.
      • CompatibleObjectEncoder

        public CompatibleObjectEncoder​(int resetInterval)
        Creates a new instance.
        Parameters:
        resetInterval - the number of objects between ObjectOutputStream.reset(). 0 will disable resetting the stream, but the remote peer will be at the risk of getting OutOfMemoryError in the long term.