public class PublicBAOS extends ByteArrayOutputStream
ByteArrayOutputStream. It's used to return the byte array
directly. Note that the size of byte array is large than actual size of valid contents, thus it's
used cooperating with size() or capacity = sizebuf, count| Constructor and Description |
|---|
PublicBAOS() |
PublicBAOS(int size) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBuf()
get current all bytes data
|
void |
reset()
It's not a thread-safe method.
|
int |
size()
The synchronized keyword in this function is intentionally removed.
|
void |
truncate(int size) |
void |
writeTo(OutputStream out)
It's not a thread-safe method.
|
close, toByteArray, toString, toString, toString, write, writeflush, writepublic byte[] getBuf()
public void writeTo(OutputStream out) throws IOException
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).
writeTo in class ByteArrayOutputStreamout - the output stream to which to write the data.IOException - if an I/O error occurs.public 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. The output stream can be used
again, reusing the already allocated buffer space.
reset in class ByteArrayOutputStreampublic int size()
size in class ByteArrayOutputStreampublic void truncate(int size)
Copyright © 2022 The Apache Software Foundation. All rights reserved.