public class PoolingByteArrayOutputStream
extends java.io.ByteArrayOutputStream
ByteArrayOutputStream that uses a pool of byte[] buffers instead
of always allocating them fresh, saving on heap churn.| Constructor and Description |
|---|
PoolingByteArrayOutputStream(ByteArrayPool pool)
Constructs a new PoolingByteArrayOutputStream with a default size.
|
PoolingByteArrayOutputStream(ByteArrayPool pool,
int size)
Constructs a new
ByteArrayOutputStream with a default size of size bytes. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
finalize() |
void |
write(byte[] buffer,
int offset,
int len) |
void |
write(int oneByte) |
public PoolingByteArrayOutputStream(ByteArrayPool pool)
public PoolingByteArrayOutputStream(ByteArrayPool pool, int size)
ByteArrayOutputStream with a default size of size bytes. If
more than size bytes are written to this instance, the underlying byte array will
expand.size - initial size for the underlying byte array. The value will be pinned to a default
minimum size.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.ByteArrayOutputStreamjava.io.IOExceptionpublic void finalize()
finalize in class java.lang.Objectpublic void write(byte[] buffer,
int offset,
int len)
write in class java.io.ByteArrayOutputStreampublic void write(int oneByte)
write in class java.io.ByteArrayOutputStream