Package org.apache.hadoop.hbase.io
Class ByteBufferInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.hbase.io.ByteBufferInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Not thread safe!
Please note that the reads will cause position movement on wrapped ByteBuffer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.InputStream
close, mark, markSupported, read, reset
-
Field Details
-
buf
-
-
Constructor Details
-
ByteBufferInputStream
-
-
Method Details
-
read
Reads the next byte of data from this input stream. The value byte is returned as anintin the range0to255. If no byte is available because the end of the stream has been reached, the value-1is returned.- Specified by:
readin classInputStream- Returns:
- the next byte of data, or
-1if the end of the stream has been reached.
-
read
Reads up to nextlenbytes of data from buffer into passed array(starting from given offset).- Overrides:
readin classInputStream- Parameters:
b- the array into which the data is read.off- the start offset in the destination arrayblen- the maximum number of bytes to read.- Returns:
- the total number of bytes actually read into the buffer, or
-1if not even 1 byte can be read because the end of the stream has been reached.
-
skip
Skipsnbytes of input from this input stream. Fewer bytes might be skipped if the end of the input stream is reached. The actual numberkof bytes to be skipped is equal to the smaller ofnand remaining bytes in the stream.- Overrides:
skipin classInputStream- Parameters:
n- the number of bytes to be skipped.- Returns:
- the actual number of bytes skipped.
-
available
- Overrides:
availablein classInputStream- Returns:
- the number of remaining bytes that can be read (or skipped over) from this input stream.
-