public final class FastByteArrayOutputStream
extends java.io.ByteArrayOutputStream
ByteArrayOutputStream implementation. This version
also has a constructor that lets you create a stream with initial content.| Modifier and Type | Field and Description |
|---|---|
protected int |
maxGrowSize
Max grow size (unless if writing more than this amount of bytes)
|
| Constructor and 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 and Description |
|---|---|
java.io.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(java.io.OutputStream pOut) |
protected 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 java.io.ByteArrayOutputStreampublic void write(int pByte)
write in class java.io.ByteArrayOutputStreampublic void writeTo(java.io.OutputStream pOut)
throws java.io.IOException
writeTo in class java.io.ByteArrayOutputStreamjava.io.IOExceptionpublic byte[] toByteArray()
toByteArray in class java.io.ByteArrayOutputStreampublic java.io.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 © 2021. All Rights Reserved.