Class MutableByteArrayInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class MutableByteArrayInputStream
    extends ByteArrayInputStream
    An extension of the ByteArrayInputStream that allows to change a buffer that should be read without creating a new ByteArrayInputStream instance. This allows to re-use the same InputStream instance, copying message to process, and creation of Decoder on every new message.
    • Constructor Detail

      • MutableByteArrayInputStream

        public MutableByteArrayInputStream()
    • Method Detail

      • setBuffer

        public void setBuffer​(byte[] buf)
        Set buffer that can be read via the InputStream interface and reset the input stream. This has the same effect as creating a new ByteArrayInputStream with a new buffer.
        Parameters:
        buf - the new buffer to read.