DthingApi
|
Public Member Functions | |
ByteArrayOutputStream () | |
ByteArrayOutputStream (int size) | |
void | close () throws IOException |
synchronized void | reset () |
int | size () |
synchronized byte [] | toByteArray () |
String | toString () |
String | toString (String enc) throws UnsupportedEncodingException |
synchronized void | write (byte[] buffer, int offset, int len) |
synchronized void | write (int oneByte) |
synchronized void | writeTo (OutputStream out) throws IOException |
![]() | |
OutputStream () | |
void | close () throws IOException |
void | flush () throws IOException |
void | write (byte[] buffer) throws IOException |
void | write (byte[] buffer, int offset, int count) throws IOException |
abstract void | write (int oneByte) throws IOException |
Protected Attributes | |
byte [] | buf |
int | count |
A specialized OutputStream for class for writing content to an (internal) byte array. As bytes are written to this stream, the byte array may be expanded to hold more bytes. When the writing is considered to be finished, a copy of the byte array can be requested from the class.
|
inline |
Constructs a new ByteArrayOutputStream with a default size of 32 bytes. If more than 32 bytes are written to this instance, the underlying byte array will expand.
|
inline |
Constructs a new
with a default size of
bytes. If more than
bytes are written to this instance, the underlying byte array will expand.
size | initial size for the underlying byte array, must be non-negative. |
IllegalArgumentException | if < 0. |
|
inline |
Closes this stream. This releases system resources used for this stream.
IOException | if an error occurs while attempting to close this stream. |
Although the spec claims "A closed stream cannot perform output operations and cannot be reopened.", this implementation must do nothing.
|
inline |
Resets this stream to the beginning of the underlying byte array. All subsequent writes will overwrite any bytes previously stored in this stream.
|
inline |
Returns the total number of bytes written to this stream so far.
|
inline |
Returns the contents of this ByteArrayOutputStream as a byte array. Any changes made to the receiver after returning will not be reflected in the byte array returned to the caller.
|
inline |
Returns the contents of this ByteArrayOutputStream as a string. Any changes made to the receiver after returning will not be reflected in the string returned to the caller.
|
inline |
Returns the contents of this ByteArrayOutputStream as a string converted according to the encoding declared in
.
enc | a string representing the encoding to use when translating this stream to a string. |
UnsupportedEncodingException | if the provided encoding is not supported. |
|
inline |
Writes
bytes from the byte array
starting at offset
to this stream.
buffer | the buffer to be written. |
offset | the initial position in buffer |
len | the number of bytes of buffer |
NullPointerException | if buffer null |
IndexOutOfBoundsException | if offset < 0 len < 0 offset + len buffer |
|
inline |
Writes the specified byte
to the OutputStream. Only the low order byte of
is written.
oneByte | the byte to be written. |
|
inline |
Takes the contents of this stream and writes it to the output stream
.
out | an OutputStream on which to write the contents of this stream. |
IOException | if an error occurs while writing to out |
|
protected |
The byte array containing the bytes written.
|
protected |
The number of bytes written.