com.android.volley.toolbox
Class PoolingByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
com.android.volley.toolbox.PoolingByteArrayOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class PoolingByteArrayOutputStream
- extends ByteArrayOutputStream
A variation of ByteArrayOutputStream
that uses a pool of byte[] buffers instead
of always allocating them fresh, saving on heap churn.
PoolingByteArrayOutputStream
public PoolingByteArrayOutputStream(ByteArrayPool pool)
- Constructs a new PoolingByteArrayOutputStream with a default size. If more bytes are written
to this instance, the underlying byte array will expand.
PoolingByteArrayOutputStream
public PoolingByteArrayOutputStream(ByteArrayPool pool,
int size)
- Constructs a new
ByteArrayOutputStream
with a default size of size
bytes. If
more than size
bytes are written to this instance, the underlying byte array will
expand.
- Parameters:
size
- initial size for the underlying byte array. The value will be pinned to a default
minimum size.
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class ByteArrayOutputStream
- Throws:
IOException
finalize
public void finalize()
- Overrides:
finalize
in class Object
write
public void write(byte[] buffer,
int offset,
int len)
- Overrides:
write
in class ByteArrayOutputStream
write
public void write(int oneByte)
- Overrides:
write
in class ByteArrayOutputStream