Closeable, Flushable, AutoCloseablepublic final class FastByteArrayOutputStream extends ByteArrayOutputStream
ByteArrayOutputStream implementation. This version
also has a constructor that lets you create a stream with initial content.
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
maxGrowSize |
Max grow size (unless if writing more than this amount of bytes)
|
buf, count| Constructor | Description |
|---|---|
FastByteArrayOutputStream(byte[] pBuffer) |
Creates a
ByteArrayOutputStream with the given initial content. |
FastByteArrayOutputStream(int pSize) |
Creates a
ByteArrayOutputStream with the given initial buffer
size. |
| Modifier and Type | Method | Description |
|---|---|---|
ByteArrayInputStream |
createInputStream() |
Creates a
ByteArrayInputStream that reads directly from this
FastByteArrayOutputStream's byte buffer. |
byte[] |
toByteArray() |
|
void |
write(byte[] pBytes,
int pOffset,
int pLength) |
|
void |
write(int pByte) |
|
void |
writeTo(OutputStream pOut) |
close, reset, size, toString, toString, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitflush, writeprotected int maxGrowSize
public FastByteArrayOutputStream(int pSize)
ByteArrayOutputStream with the given initial buffer
size.pSize - initial buffer sizepublic FastByteArrayOutputStream(byte[] pBuffer)
ByteArrayOutputStream with the given initial content.
Note that the buffer is not cloned, for maximum performance.pBuffer - initial bufferpublic void write(byte[] pBytes,
int pOffset,
int pLength)
write in class ByteArrayOutputStreampublic void write(int pByte)
write in class ByteArrayOutputStreampublic void writeTo(OutputStream pOut) throws IOException
writeTo in class ByteArrayOutputStreamIOExceptionpublic byte[] toByteArray()
toByteArray in class ByteArrayOutputStreampublic ByteArrayInputStream createInputStream()
ByteArrayInputStream that reads directly from this
FastByteArrayOutputStream's byte buffer.
The buffer is not cloned, for maximum performance.
Note that care needs to be taken to avoid writes to
this output stream after the input stream is created.
Failing to do so, may result in unpredictable behaviour.ByteArrayInputStream, reading from this stream's buffer.Copyright © 2018. All rights reserved.