Class InitiallyReusableByteArrayOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public final class InitiallyReusableByteArrayOutputStream
    extends ByteArrayOutputStream
    A take on ByteArrayOutputStream that takes a provided byte array as its initial buffer. This is useful for situations where there is only one thread at a time creating these objects and allocating the initial array is expensive.
    Since:
    2.0.0
    Author:
    Diogo Ferreira (diogo.ferreira@feedzai.com)
    • Constructor Detail

      • InitiallyReusableByteArrayOutputStream

        public InitiallyReusableByteArrayOutputStream​(byte[] initialArray)
        Builds an instance with an initial buffer.
        Parameters:
        initialArray - The initial buffer array.