org.mortbay.util
Class ByteBufferOutputStream
java.lang.Object
|
+--java.io.OutputStream
|
+--org.mortbay.util.ByteBufferOutputStream
- public class ByteBufferOutputStream
- extends java.io.OutputStream
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.
- Version:
- $Revision: 1.1 $
- Author:
- Greg Wilkins (gregw)
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteBufferOutputStream
public ByteBufferOutputStream()
- Constructor.
ByteBufferOutputStream
public ByteBufferOutputStream(int capacity)
- Constructor.
- Parameters:
capacity
- Buffer capacity
ByteBufferOutputStream
public ByteBufferOutputStream(int capacity,
int fullAt,
int reserve)
- Constructor.
- Parameters:
capacity
- Buffer capacity.fullAt
- The size at which isFull returns true.reserve
- The reserve of byte for prepending
size
public int size()
getCapacity
public int getCapacity()
isFull
public boolean isFull()
writeTo
public void writeTo(java.io.OutputStream out)
throws java.io.IOException
write
public void write(int b)
- Overrides:
write
in class java.io.OutputStream
write
public void write(byte[] b)
- Overrides:
write
in class java.io.OutputStream
write
public void write(byte[] b,
int offset,
int length)
- Overrides:
write
in class java.io.OutputStream
prewrite
public void prewrite(int b)
- Write byte to start of the buffer.
- Parameters:
b
-
prewrite
public void prewrite(byte[] b)
- Write byte array to start of the buffer.
- Parameters:
b
-
prewrite
public void prewrite(byte[] b,
int offset,
int length)
- Write byte range to start of the buffer.
- Parameters:
b
- offset
- length
-
flush
public void flush()
- Overrides:
flush
in class java.io.OutputStream
reset
public void reset()
close
public void close()
- Overrides:
close
in class java.io.OutputStream
ensureReserve
public void ensureReserve(int n)
ensureCapacity
public void ensureCapacity(int n)
Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.