public final class ByteArrayOStream
extends java.io.OutputStream
ByteArrayIStream
without intermediate array copies.All argument validation is disabled in release mode.
NOTE: copy-on-write not supported
Modifier and Type | Field and Description |
---|---|
private byte[] |
m_buf |
private int |
m_pos |
private static int |
NATIVE_COPY_THRESHOLD |
Constructor and Description |
---|
ByteArrayOStream(int initialCapacity)
Callee takes ownership of 'buf'.
|
Modifier and Type | Method and Description |
---|---|
int |
capacity() |
void |
close()
Equivalent to
reset() . |
byte[] |
copyByteArray() |
byte[] |
getByteArray() |
void |
reset()
Does not reduce the current capacity.
|
int |
size() |
ByteArrayIStream |
toByteIStream() |
void |
write(byte[] buf,
int offset,
int length) |
void |
write(int b) |
void |
write2(int b1,
int b2) |
void |
write3(int b1,
int b2,
int b3) |
void |
write4(int b1,
int b2,
int b3,
int b4) |
void |
writeTo(java.io.OutputStream out) |
private byte[] m_buf
private int m_pos
private static final int NATIVE_COPY_THRESHOLD
public ByteArrayOStream(int initialCapacity)
public final ByteArrayIStream toByteIStream()
public final void write2(int b1, int b2)
public final void write3(int b1, int b2, int b3)
public final void write4(int b1, int b2, int b3, int b4)
public final void writeTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public final byte[] getByteArray()
public final byte[] copyByteArray()
public final int size()
public final int capacity()
public final void reset()
public final void write(int b)
write
in class java.io.OutputStream
public final void write(byte[] buf, int offset, int length)
write
in class java.io.OutputStream
public final void close()
reset()
.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream