Class ByteArrayOutputStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ByteArrayOutputStream extends AbstractByteArrayOutputStream
Implements a ThreadSafe version of AbstractByteArrayOutputStream using instance synchronization.
  • Constructor Details

    • ByteArrayOutputStream

      public ByteArrayOutputStream()
      Creates a new byte array output stream. The buffer capacity is initially 1024 bytes, though its size increases if necessary.
    • ByteArrayOutputStream

      public ByteArrayOutputStream(int size)
      Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
      Parameters:
      size - the initial size
      Throws:
      IllegalArgumentException - if size is negative
  • Method Details