Class NoCopyByteArrayOutputStream

java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
co.elastic.clients.util.NoCopyByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class NoCopyByteArrayOutputStream extends ByteArrayOutputStream
A ByteArrayOutputStream that reduces copy operations of its underlying buffer.
  • Constructor Details

    • NoCopyByteArrayOutputStream

      public NoCopyByteArrayOutputStream()
    • NoCopyByteArrayOutputStream

      public NoCopyByteArrayOutputStream(int size)
  • Method Details

    • array

      public byte[] array()
      Get the underlying buffer. Data was added to this buffer up to size(). Note that calling this method again may return a different result if additional data was inserted and the buffer had to grow.
    • asInputStream

      public ByteArrayInputStream asInputStream()
      Get an InputStream view on this object, based on the current buffer and size.