java.io.Closeable, java.lang.AutoCloseable@LimitedPrivate({"HDFS","MapReduce"})
@Unstable
public class InputBuffer
extends java.io.FilterInputStream
InputStream implementation that reads from an in-memory
buffer.
This saves memory over creating a new InputStream and ByteArrayInputStream each time data is read.
Typical usage is something like the following:
InputBuffer buffer = new InputBuffer();
while (... loop condition ...) {
byte[] data = ... get data ...;
int dataLength = ... get data length ...;
buffer.reset(data, dataLength);
... read buffer using InputStream methods ...
}
DataInputBuffer,
DataOutput| Constructor | Description |
|---|---|
InputBuffer() |
Constructs a new empty buffer.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
getLength() |
Returns the length of the input.
|
int |
getPosition() |
Returns the current position in the input.
|
void |
reset(byte[] input,
int length) |
Resets the data that the buffer reads.
|
void |
reset(byte[] input,
int start,
int length) |
Resets the data that the buffer reads.
|
available, close, mark, markSupported, read, read, read, reset, skippublic void reset(byte[] input,
int length)
input - input.length - length.public void reset(byte[] input,
int start,
int length)
input - input.start - start.length - length.public int getPosition()
public int getLength()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.