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.
Author
Arthur van Hoff
Since
1.0
Functions
Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.
Creates a newly allocated byte array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it.
Converts the buffer's contents into a string decoding bytes using the default charset. The length of the new String is a function of the charset, and hence may not be equal to the size of the buffer.
Converts the buffer's contents into a string by decoding the bytes using the named charset.
Converts the buffer's contents into a string by decoding the bytes using the specified charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array.
Writes the specified byte to this ByteArrayOutputStream.
Writes len bytes from the specified byte array starting at offset off to this ByteArrayOutputStream.
Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).
Writes the complete contents of the specified byte array to this ByteArrayOutputStream.
Writes the complete contents of this ByteArrayOutputStream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).