public final class FastByteArrayOutputStream extends OutputStream
ByteArrayOutputStream| Constructor and Description |
|---|
FastByteArrayOutputStream()
Creates a new byte array output stream.
|
FastByteArrayOutputStream(int size)
Creates a new byte array output stream, with a buffer capacity of
the specified size, in bytes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closing a ByteArrayOutputStream has no effect.
|
FastByteArrayInputStream |
convertToInputStream()
Creates InputStream using the same data that is written into this stream with no copying in memory
|
void |
copyFrom(FastByteArrayInputStream source,
int offset,
int count)
Copies data from input stream
|
void |
copyTo(DataOutput dest) |
void |
copyTo(OutputStream dest) |
byte[] |
getBuffer() |
void |
reset() |
int |
size()
Returns the current size of the buffer.
|
byte[] |
toByteArray()
returns inner array
|
ByteBuffer |
toByteBuffer() |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to this byte array output stream. |
void |
write(int b)
Writes the specified byte to this byte array output stream.
|
void |
writeTo(OutputStream output) |
flush, writepublic FastByteArrayOutputStream()
public FastByteArrayOutputStream(int size)
size - the initial size.IllegalArgumentException - if size is negative.public void write(int b)
write in class OutputStreamb - the byte to be written.public void write(byte[] b,
int off,
int len)
len bytes from the specified byte array
starting at offset off to this byte array output stream.write in class OutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.public byte[] toByteArray()
public void writeTo(OutputStream output) throws IOException
IOExceptionpublic int size()
count field, which is the number
of valid bytes in this output stream.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void copyFrom(FastByteArrayInputStream source, int offset, int count)
source - source streamoffset - offset in the sourcecount - number of bytes to copypublic void copyTo(OutputStream dest) throws IOException
IOExceptionpublic void copyTo(DataOutput dest) throws IOException
IOExceptionpublic FastByteArrayInputStream convertToInputStream()
public ByteBuffer toByteBuffer()
public byte[] getBuffer()
public void reset()
Copyright © 2020. All rights reserved.