Class ByteArrayOutputStream

java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
com.itextpdf.io.source.ByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ByteArrayOutputStream extends ByteArrayOutputStream
A byte-array output stream whose backing array can be assigned directly.
  • Constructor Details

    • ByteArrayOutputStream

      public ByteArrayOutputStream()
      Creates an empty stream with the default initial capacity.
    • ByteArrayOutputStream

      public ByteArrayOutputStream (int size)
      Creates an empty stream with the specified initial capacity.
      Parameters:
      size - the initial backing-array size
  • Method Details

    • assignBytes

      public ByteArrayOutputStream assignBytes (byte[] bytes, int count)
      Replaces this stream's backing array and logical byte count.
      Parameters:
      bytes - the replacement backing array, retained without copying
      count - the number of bytes in bytes considered written
      Returns:
      this stream
    • assignBytes

      public ByteArrayOutputStream assignBytes (byte[] bytes)
      Replaces this stream's backing array and marks all of it as written.
      Parameters:
      bytes - the replacement backing array, retained without copying
      Returns:
      this stream