public final class LocalBlockInStream extends BufferedBlockInStream
mBlockId, mBlockIsRead, mBlockSize, mBuffer, mClosed, mLocation
Constructor and Description |
---|
LocalBlockInStream(long blockId,
long blockSize,
InetSocketAddress location)
Creates a new local block input stream.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bufferedRead(int len)
Reads from the data source into the buffer.
|
void |
close() |
int |
directRead(byte[] b,
int off,
int len)
Directly reads data to the given byte array.
|
protected void |
incrementBytesReadMetric(int bytes)
Increments the number of bytes read metric.
|
getPosition, read, read, read, remaining, seek, skip
available, mark, markSupported, reset
public LocalBlockInStream(long blockId, long blockSize, InetSocketAddress location) throws IOException
blockId
- the block idIOException
- if I/O error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class BufferedBlockInStream
IOException
protected void bufferedRead(int len) throws IOException
BufferedBlockInStream
bufferedRead
in class BufferedBlockInStream
len
- length of data to fill in the buffer, must always be <= buffer sizeIOException
- if the read failed to buffer the requested number of bytespublic int directRead(byte[] b, int off, int len) throws IOException
BufferedBlockInStream
directRead
in class BufferedBlockInStream
b
- the byte array to write the data tooff
- the offset in the array to write tolen
- the length of data to write into the array must always be valid within the blockIOException
- if an error occurs reading the dataprotected void incrementBytesReadMetric(int bytes)
BufferedBlockInStream
incrementBytesReadMetric
in class BufferedBlockInStream
bytes
- number of bytes to record as readCopyright © 2015. All Rights Reserved.