@InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"}) @InterfaceStability.Unstable public class BoundedByteArrayOutputStream extends OutputStream
reset
API and choose different limits in each round.Modifier | Constructor and Description |
---|---|
protected |
BoundedByteArrayOutputStream(byte[] buf,
int offset,
int limit) |
|
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 |
---|---|
int |
available() |
byte[] |
getBuffer()
Returns the underlying buffer.
|
int |
getLimit()
Return the current limit
|
void |
reset()
Reset the buffer
|
void |
reset(int newlim)
Reset the limit
|
protected void |
resetBuffer(byte[] buf,
int offset,
int 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) |
close, flush, write
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 writtenprotected BoundedByteArrayOutputStream(byte[] buf, int offset, int limit)
protected void resetBuffer(byte[] buf, int offset, int limit)
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void reset(int newlim)
newlim
- New Limitpublic void reset()
public int getLimit()
public byte[] getBuffer()
size()
.public int size()
public int available()
Copyright © 2013 Apache Software Foundation. All rights reserved.