Class ByteArrayOutputStream

java.lang.Object
java.io.OutputStream
com.landawn.abacus.util.ByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public final class ByteArrayOutputStream extends OutputStream
Since:
0.8
Author:
Haiyang Li
  • Constructor Details

    • ByteArrayOutputStream

      public ByteArrayOutputStream()
    • ByteArrayOutputStream

      public ByteArrayOutputStream(int size)
      Parameters:
      size -
  • Method Details

    • write

      public void write(int b)
      Specified by:
      write in class OutputStream
      Parameters:
      b -
    • write

      public void write(byte[] b, int off, int len)
      Overrides:
      write in class OutputStream
      Parameters:
      b -
      off -
      len -
    • write

      public void write(byte b)
      Parameters:
      b -
    • writeTo

      public void writeTo(OutputStream out) throws IOException
      Parameters:
      out -
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • capacity

      public int capacity()
      Returns:
    • array

      public byte[] array()
      Returns:
    • size

      public int size()
      Returns:
    • reset

      public void reset()
      Reset.
    • toByteArray

      public byte[] toByteArray()
      To byte array.
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
    • toString

      public String toString(Charset charset)
      Parameters:
      charset -
      Returns:
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - Signals that an I/O exception has occurred.