|
FlexDoc/Javadoc 2.0 Demo Java Doc |
Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.
Field Summary |
||
protected byte[] |
The buffer where data is stored.
|
|
protected int |
The number of valid bytes in the buffer.
|
Constructor Summary |
||
Creates a new ByteArrayOutputStream.
|
||
ByteArrayOutputStream(int size)
Creates a new ByteArrayOutputStream, with a buffer capacity of
the specified size, in bytes.
|
Method Summary |
||
void |
close()
Closing a ByteArrayOutputStream has no effect.
|
|
void |
reset()
Resets the count field of this ByteArrayOutputStream
to zero, so that all currently accumulated output in the
output stream is discarded.
|
|
int |
size()
Returns the current size of the buffer.
|
|
byte[] |
Creates a newly allocated byte array.
|
|
toString()
Converts the buffer's contents into a string decoding bytes using the
platform's default character set.
|
||
Converts the buffer's contents into a string by decoding the bytes using
the specified charset.
|
||
toString(int hibyte)
Deprecated. This method does not properly convert bytes into characters.
|
||
Converts the buffer's contents into a string by decoding the bytes using
the named charset.
|
||
void |
write(byte[] b, int off, int len)
Writes len bytes from the specified byte array
starting at offset off to this ByteArrayOutputStream.
|
|
void |
write(int b)
Writes the specified byte to this ByteArrayOutputStream.
|
|
void |
writeBytes(byte[] b)
Writes the complete contents of the specified byte array
to this ByteArrayOutputStream.
|
|
void |
writeTo(OutputStream out)
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).
|
Methods inherited from class java.io.OutputStream |
Methods inherited from class java.lang.Object |
public ByteArrayOutputStream |
() |
public ByteArrayOutputStream |
(int size) |
public void write |
(int b) |
public void write |
(byte[] b, int off, int len) |
public void writeBytes |
(byte[] b) |
public void writeTo |
(OutputStream out) |
throws |
public void reset |
() |
public byte[] toByteArray |
() |
public int size |
() |
public String toString |
() |
This method always replaces malformed-input and unmappable-character sequences with the default replacement string for the platform's default character set. The CharsetDecoder class should be used when more control over the decoding process is required.
public String toString |
(String charsetName) |
throws |
This method is equivalent to #toString(charset) that takes a charset.
An invocation of this method of the form
ByteArrayOutputStream b = ...
b.toString("UTF-8")
behaves in exactly the same way as the expression
ByteArrayOutputStream b = ...
b.toString(StandardCharsets.UTF_8)
public String toString |
(Charset charset) |
This method always replaces malformed-input and unmappable-character sequences with the charset's default replacement string. The CharsetDecoder class should be used when more control over the decoding process is required.
public String toString |
(int hibyte) |
c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
public void close |
() |
throws |
|
FlexDoc/Javadoc 2.0 Demo Java Doc |