|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.OutputStream | +--org.mortbay.util.ByteBufferOutputStream
ByteBuffer OutputStream. This stream is similar to the java.io.ByteArrayOutputStream, except that it maintains a reserve of bytes at the start of the buffer and allows efficient prepending of data.
Constructor Summary | |
ByteBufferOutputStream()
Constructor. |
|
ByteBufferOutputStream(int capacity)
Constructor. |
|
ByteBufferOutputStream(int capacity,
int preReserve)
Constructor. |
|
ByteBufferOutputStream(int bufferSize,
int preReserve,
int postReserve)
Constructor. |
Method Summary | |
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,
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(java.io.OutputStream out)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
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 appendingMethod Detail |
public 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(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int offset, int length) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public 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, int offset, int length) throws java.io.IOException
b
- offset
- length
-
java.io.IOException
public void flush() throws java.io.IOException
flush
in class java.io.OutputStream
java.io.IOException
public void resetStream()
public void reset(int reserve)
public void close() throws java.io.IOException
close
in class java.io.OutputStream
java.io.IOException
public void destroy()
public void ensureReserve(int n)
public void ensureSize(int bufSize) throws java.io.IOException
java.io.IOException
public void ensureSize(int bufSize, int pre, int post) throws java.io.IOException
java.io.IOException
public void ensureSpareCapacity(int n) throws java.io.IOException
java.io.IOException
public void ensureCapacity(int n) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |