|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.apache.hadoop.zebra.tfile.BoundedByteArrayOutputStream
public class BoundedByteArrayOutputStream
A byte array backed output stream with a limit. The limit should be smaller
than the buffer capacity. The object can be reused through reset
API and choose different limits in each round.
| Constructor Summary | |
|---|---|
BoundedByteArrayOutputStream(int capacity)
Create a BoundedByteArrayOutputStream with the specified capacity |
|
BoundedByteArrayOutputStream(int capacity,
int limit)
Create a BoundedByteArrayOutputStream with the specified capacity and limit. |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.io.OutputStream |
|---|
close, flush, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BoundedByteArrayOutputStream(int capacity)
capacity - The capacity of the underlying byte array
public BoundedByteArrayOutputStream(int capacity,
int limit)
capacity - The capacity of the underlying byte arraylimit - The maximum limit upto which data can be written| Method Detail |
|---|
public void write(int b)
throws IOException
write in class OutputStreamIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void reset(int newlim)
newlim - New Limitpublic void reset()
public int getLimit()
public byte[] getBuffer()
size().
public int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||