public class RestrictedByteArrayCacheOutputStream
extends OutputStream
Modifier and Type | Class and Description |
---|---|
static interface |
RestrictedByteArrayCacheOutputStream.FlushPreAction |
Modifier and Type | Field and Description |
---|---|
protected byte[] |
cache |
protected int |
cacheCapacity |
protected RestrictedByteArrayCacheOutputStream.FlushPreAction |
flushPreAction |
protected int |
index |
protected OutputStream |
outputStream |
protected boolean |
overflowed |
Constructor and Description |
---|
RestrictedByteArrayCacheOutputStream(OutputStream outputStream,
int initialCacheSize,
int cacheCapacity,
RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction) |
RestrictedByteArrayCacheOutputStream(OutputStream outputStream,
int cacheCapacity,
RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction) |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureCacheSize(int newIndex) |
void |
flush() |
int |
getCacheCapacity() |
boolean |
isOverflowed() |
void |
reset() |
int |
size() |
byte[] |
toByteArray() |
byte[] |
unsafeGetByteArray() |
ByteBuffer |
unsafeGetByteBuffer() |
void |
write(byte[] bytes) |
void |
write(byte[] bytes,
int offset,
int length) |
void |
write(int b) |
protected byte[] cache
protected int cacheCapacity
protected RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction
protected int index
protected OutputStream outputStream
protected boolean overflowed
public RestrictedByteArrayCacheOutputStream(OutputStream outputStream, int cacheCapacity, RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)
public RestrictedByteArrayCacheOutputStream(OutputStream outputStream, int initialCacheSize, int cacheCapacity, RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public int getCacheCapacity()
public boolean isOverflowed()
public void reset()
public int size()
public byte[] toByteArray()
public byte[] unsafeGetByteArray()
public ByteBuffer unsafeGetByteBuffer()
public void write(byte[] bytes) throws IOException
write
in class OutputStream
IOException
public void write(byte[] bytes, int offset, int length) throws IOException
write
in class OutputStream
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
protected void ensureCacheSize(int newIndex)