public class BoundedByteArrayOutputStream
extends java.io.OutputStream
reset
API and choose different limits in each round.Constructor and Description |
---|
BoundedByteArrayOutputStream(int capacity)
Create a BoundedByteArrayOutputStream with the specified
capacity
|
BoundedByteArrayOutputStream(int capacity,
int limit)
Create a BoundedByteArrayOutputStream with the specified
capacity and limit.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBuffer()
Returns the underlying buffer.
|
int |
getLimit()
Return the current limit
|
void |
reset()
Reset the buffer
|
void |
reset(int newlim)
Reset the limit
|
int |
size()
Returns the length of the valid data
currently in the buffer.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public BoundedByteArrayOutputStream(int capacity)
capacity
- The capacity of the underlying byte arraypublic BoundedByteArrayOutputStream(int capacity, int limit)
capacity
- The capacity of the underlying byte arraylimit
- The maximum limit upto which data can be writtenpublic void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void reset(int newlim)
newlim
- New Limitpublic void reset()
public int getLimit()
public byte[] getBuffer()
size()
.public int size()
Copyright © 2007-2012 The Apache Software Foundation