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 Flushableflush in class OutputStreamIOExceptionpublic 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 OutputStreamIOExceptionpublic void write(byte[] bytes,
int offset,
int length)
throws IOException
write in class OutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionprotected void ensureCacheSize(int newIndex)