public final class RemoteBlockInStream extends BufferedBlockInStream
mBlockId, mBlockIsRead, mBlockSize, mBuffer, mClosed, mLocation
Constructor and Description |
---|
RemoteBlockInStream(long blockId,
long blockSize,
InetSocketAddress location)
Creates a new remote block input stream.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bufferedRead(int len)
Reads from the data source into the buffer.
|
void |
close() |
protected 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 RemoteBlockInStream(long blockId, long blockSize, InetSocketAddress location)
blockId
- the block idblockSize
- the block sizelocation
- the locationpublic 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 bytesprotected 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)
incrementBytesReadMetric
in class BufferedBlockInStream
bytes
- number of bytes to record as readCopyright © 2015. All Rights Reserved.