java.io
ByteArrayOutputStream
Declarationpublic class ByteArrayOutputStream extends OutputStream
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.ByteArrayOutputStream
Description
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().
Since: JDK1.0, CLDC 1.0
Fields
protected byte[] buf
protected int count
Constructors
ByteArrayOutputStream()
ByteArrayOutputStream(int size)
Methods
void close()
void reset()
int size()
byte[] toByteArray()
java.lang.String toString()
void write(byte[] b, int off, int len)
void write(int b)
Methods inherited from class Object
equals(Object), getClass(), hashCode(), notify(), notifyAll(), wait(), wait(), wait()
Methods inherited from class OutputStream
flush(), write(byte[])
Fields
buf
Declaration:
protected byte[] buf
Description:
The buffer where data is stored.
count
Declaration:
protected int count
Description:
The number of valid bytes in the buffer.
Constructors
ByteArrayOutputStream()
Declaration:
public ByteArrayOutputStream()
Description:
Creates a new byte array output stream. The buffer capacity is initially 32 bytes, though its size increases if
necessary.
ByteArrayOutputStream(int)
Declaration:
public ByteArrayOutputStream(int size)
Description:
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
Parameters:
size - the initial size.
Throws:
java.lang.IllegalArgumentException - if size is negative.
No comments:
Post a Comment