ByteArrayOutputStream

public class ByteArrayOutputStream
extends OutputStream

java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.ByteArrayOutputStream


This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().

Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

Summary

Fields

protected byte[] buf

The buffer where data is stored.

protected int count

The number of valid bytes in the buffer.

Public constructors

ByteArrayOutputStream()

Creates a new ByteArrayOutputStream.

ByteArrayOutputStream(int size)

Creates a new ByteArrayOutputStream, with a buffer capacity of the specified size, in bytes.

Public m