public class ByteBufferOutputStream extends OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
_buf |
| Constructor and Description |
|---|
ByteBufferOutputStream()
Constructor.
|
ByteBufferOutputStream(int capacity)
Constructor.
|
ByteBufferOutputStream(int capacity,
int preReserve)
Constructor.
|
ByteBufferOutputStream(int bufferSize,
int preReserve,
int postReserve)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
bufferSize() |
int |
capacity() |
void |
close() |
void |
destroy() |
void |
ensureCapacity(int n) |
void |
ensureReserve(int n) |
void |
ensureSize(int bufSize) |
void |
ensureSize(int bufSize,
int pre,
int post) |
void |
ensureSpareCapacity(int n) |
void |
flush() |
boolean |
isFixed() |
int |
postReserve() |
void |
postwrite(byte b)
Write bytes into the postreserve.
|
void |
postwrite(byte[] b,
int offset,
int length)
Write bytes into the postreserve.
|
int |
preReserve() |
void |
prewrite(byte[] b)
Write byte array to start of the buffer.
|
void |
prewrite(byte[] b,
int offset,
int length)
Write byte range to start of the buffer.
|
void |
prewrite(int b)
Write byte to start of the buffer.
|
void |
reset(int reserve) |
void |
resetStream() |
void |
setFixed(boolean fixed) |
int |
size() |
int |
spareCapacity() |
void |
write(byte[] b) |
void |
write(byte[] b,
int offset,
int length) |
void |
write(int b) |
void |
writeTo(OutputStream out) |
public ByteBufferOutputStream()
public ByteBufferOutputStream(int capacity)
capacity - Buffer capacitypublic ByteBufferOutputStream(int capacity,
int preReserve)
capacity - Buffer capacity.preReserve - The reserve of byte for prependingpublic ByteBufferOutputStream(int bufferSize,
int preReserve,
int postReserve)
bufferSize - The size of the buffer == capacity+preReserve+postReservepreReserve - The reserve of byte for prependingpostReserve - The reserve of byte for appendingpublic boolean isFixed()
public void setFixed(boolean fixed)
fixed - True if the buffer cannot be expandedpublic int size()
public int bufferSize()
public int capacity()
public int spareCapacity()
public int preReserve()
public int postReserve()
public void writeTo(OutputStream out) throws IOException
IOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int offset,
int length)
throws IOException
write in class OutputStreamIOExceptionpublic void prewrite(int b)
b - public void prewrite(byte[] b)
b - public void prewrite(byte[] b,
int offset,
int length)
b - offset - length - public void postwrite(byte b)
throws IOException
b - offset - length - IOExceptionpublic void postwrite(byte[] b,
int offset,
int length)
throws IOException
b - offset - length - IOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void resetStream()
public void reset(int reserve)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void destroy()
public void ensureReserve(int n)
public void ensureSize(int bufSize)
throws IOException
IOExceptionpublic void ensureSize(int bufSize,
int pre,
int post)
throws IOException
IOExceptionpublic void ensureSpareCapacity(int n)
throws IOException
IOExceptionpublic void ensureCapacity(int n)
throws IOException
IOExceptionCopyright © 2016. All Rights Reserved.