public class ExposedByteArrayOutputStream extends ByteArrayOutputStream
buf, count| Constructor and Description |
|---|
ExposedByteArrayOutputStream() |
ExposedByteArrayOutputStream(int size) |
| Modifier and Type | Method and Description |
|---|---|
Buffer |
getBuffer() |
int |
getCapacity() |
byte[] |
getRawBuffer() |
void |
reset()
Resets the
count field of this byte array output
stream to zero, so that all currently accumulated output in the
output stream is discarded. |
void |
reset(int max_size)
Resets count and creates a new buf if the current buf is > max_size.
|
int |
size()
Returns the current size of the buffer.
|
byte[] |
toByteArray()
Creates a newly allocated byte array.
|
String |
toString()
Converts the buffer's contents into a string decoding bytes using the
platform's default character set.
|
String |
toString(String charsetName)
Converts the buffer's contents into a string by decoding the bytes using
the specified
charsetName. |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to this byte array output stream. |
void |
write(int b) |
void |
writeTo(OutputStream out)
Writes the complete contents of this byte array output stream to
the specified output stream argument, as if by calling the output
stream's write method using
out.write(buf, 0, count). |
close, toStringflush, writepublic ExposedByteArrayOutputStream()
public ExposedByteArrayOutputStream(int size)
public void reset(int max_size)
public byte[] getRawBuffer()
public Buffer getBuffer()
public int getCapacity()
public void write(int b)
write in class ByteArrayOutputStreampublic void write(byte[] b,
int off,
int len)
len bytes from the specified byte array
starting at offset off to this byte array output stream.write in class ByteArrayOutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.public void writeTo(OutputStream out) throws IOException
out.write(buf, 0, count).writeTo in class ByteArrayOutputStreamout - the output stream to which to write the data.IOException - if an I/O error occurs.public void reset()
count field of this byte array output
stream to zero, so that all currently accumulated output in the
output stream is discarded. The output stream can be used again,
reusing the already allocated buffer space.reset in class ByteArrayOutputStreamByteArrayInputStream.countpublic byte[] toByteArray()
toByteArray in class ByteArrayOutputStreamByteArrayOutputStream.size()public int size()
size in class ByteArrayOutputStreamcount field, which is the number
of valid bytes in this output stream.ByteArrayOutputStream.countpublic 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.
toString in class ByteArrayOutputStreampublic String toString(String charsetName) throws UnsupportedEncodingException
charsetName. 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.
This method always replaces malformed-input and unmappable-character
sequences with this charset's default replacement string. The CharsetDecoder class should be used when more control
over the decoding process is required.
toString in class ByteArrayOutputStreamcharsetName - the name of a supported
charsetUnsupportedEncodingException - If the named charset is not supportedCopyright © 2012 JBoss by Red Hat. All Rights Reserved.