Class StreamUtils.OptimizedByteArrayOutputStream

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

    public static class StreamUtils.OptimizedByteArrayOutputStream
    extends java.io.ByteArrayOutputStream
    A ByteArrayOutputStream which avoids copying of the byte array if possible.
    • 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[] getBuffer()  
      byte[] toByteArray()  
      • Methods inherited from class java.io.ByteArrayOutputStream

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

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

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

      • OptimizedByteArrayOutputStream

        public OptimizedByteArrayOutputStream​(int initialSize)
    • Method Detail

      • toByteArray

        public byte[] toByteArray()
        Overrides:
        toByteArray in class java.io.ByteArrayOutputStream
      • getBuffer

        public byte[] getBuffer()