Class NoCopyByteArrayOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class NoCopyByteArrayOutputStream
    extends java.io.ByteArrayOutputStream
    This class is a simple extension of Java's ByteArrayOutputStream that exposes the internal buffer without having to make a copy of it via the normal ByteArrayOutputStream.toByteArray() method.
    • Field Summary

      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBuf()
      Returns a reference to the internal byte-buffer used by this byte-array output stream.
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NoCopyByteArrayOutputStream

        public NoCopyByteArrayOutputStream()
    • Method Detail

      • getBuf

        public byte[] getBuf()
        Returns a reference to the internal byte-buffer used by this byte-array output stream.
        Returns:
        a reference to the internal byte-buffer used by this byte-array output stream.