|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
things.common.tools.BoundedByteArrayOutputStream
public class BoundedByteArrayOutputStream
A limited ByteArrayOutputStream. Instead of just expanding it forever, throw an IOException.
Version History
EPG - Initial - 20 JUL 06
Constructor Summary | |
---|---|
BoundedByteArrayOutputStream(byte[] buffer)
Construct. |
Method Summary | |
---|---|
void |
close()
Close. |
void |
copyMarkTo(java.io.OutputStream ous)
Copy from the last mark (or start if not mark made) to the end of the buffer into a stream. |
byte[] |
get()
Get the total buffer. |
int |
getFillSize()
Get how much of the buffer is filled. |
int |
mark()
Mark the next spot that will get a byte and return the value. |
void |
write(byte[] b)
Writes b.length bytes from the specified byte array to this output stream. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
Methods inherited from class java.io.OutputStream |
---|
flush |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoundedByteArrayOutputStream(byte[] buffer) throws java.lang.Throwable
buffer
- The buffer.
java.lang.Throwable
- if the data is not allowed.Method Detail |
---|
public byte[] get()
public int getFillSize()
public int mark()
public void copyMarkTo(java.io.OutputStream ous) throws java.io.IOException
ous
- the output stream.
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the data.
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte.
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |