private abstract static class HFileBlock.AbstractFSReader extends Object implements HFileBlock.FSReader
HFileBlock.FSReader
and some
tools for implementing HFile format version-specific block readers.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size for our buffered streams
|
protected HFileContext |
fileContext |
protected long |
fileSize
The size of the file we are reading from, or -1 if unknown.
|
protected int |
hdrSize
The size of the header
|
protected HFileSystem |
hfs
The filesystem used to access data
|
protected org.apache.hadoop.fs.Path |
path
The path (if any) where this data is coming from
|
protected Lock |
streamLock |
Constructor and Description |
---|
HFileBlock.AbstractFSReader(long fileSize,
HFileSystem hfs,
org.apache.hadoop.fs.Path path,
HFileContext fileContext) |
Modifier and Type | Method and Description |
---|---|
HFileBlock.BlockIterator |
blockRange(long startOffset,
long endOffset)
Creates a block iterator over the given portion of the
HFile . |
protected int |
readAtOffset(org.apache.hadoop.fs.FSDataInputStream istream,
byte[] dest,
int destOffset,
int size,
boolean peekIntoNextBlock,
long fileOffset,
boolean pread)
Does a positional read or a seek and read into the given buffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeStreams, getBlockDecodingContext, getDefaultBlockDecodingContext, readBlockData, unbufferStream
protected long fileSize
protected final int hdrSize
protected HFileSystem hfs
protected org.apache.hadoop.fs.Path path
protected final Lock streamLock
public static final int DEFAULT_BUFFER_SIZE
protected HFileContext fileContext
public HFileBlock.AbstractFSReader(long fileSize, HFileSystem hfs, org.apache.hadoop.fs.Path path, HFileContext fileContext) throws IOException
IOException
public HFileBlock.BlockIterator blockRange(long startOffset, long endOffset)
HFileBlock.FSReader
HFile
.
The iterator returns blocks starting with offset such that offset <=
startOffset < endOffset. Returned blocks are always unpacked.blockRange
in interface HFileBlock.FSReader
startOffset
- the offset of the block to start iteration withendOffset
- the offset to end iteration at (exclusive)protected int readAtOffset(org.apache.hadoop.fs.FSDataInputStream istream, byte[] dest, int destOffset, int size, boolean peekIntoNextBlock, long fileOffset, boolean pread) throws IOException
dest
- destination bufferdestOffset
- offset in the destination buffersize
- size of the block to be readpeekIntoNextBlock
- whether to read the next block's on-disk sizefileOffset
- position in the stream to read atpread
- whether we should do a positional readistream
- The input source of dataIOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.