|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.io.hfile.HFileBlock.AbstractFSReader
public abstract static class HFileBlock.AbstractFSReader
A common implementation of some methods of HFileBlock.FSReader
and some
tools for implementing HFile format version-specific block readers.
Field Summary | |
---|---|
protected Compression.Algorithm |
compressAlgo
Compression algorithm used by the HFile |
static int |
DEFAULT_BUFFER_SIZE
The default buffer size for our buffered streams |
protected long |
fileSize
The size of the file we are reading from, or -1 if unknown. |
protected org.apache.hadoop.fs.FSDataInputStream |
istream
The file system stream of the underlying HFile |
Constructor Summary | |
---|---|
HFileBlock.AbstractFSReader(org.apache.hadoop.fs.FSDataInputStream istream,
Compression.Algorithm compressAlgo,
long fileSize)
|
Method Summary | |
---|---|
HFileBlock.BlockIterator |
blockRange(long startOffset,
long endOffset)
Creates a block iterator over the given portion of the HFile . |
protected InputStream |
createBufferedBoundedStream(long offset,
int size,
boolean pread)
Creates a buffered stream reading a certain slice of the file system input stream. |
protected void |
decompress(byte[] dest,
int destOffset,
InputStream bufferedBoundedStream,
int compressedSize,
int uncompressedSize)
Decompresses data from the given stream using the configured compression algorithm. |
protected int |
readAtOffset(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader |
---|
readBlockData |
Field Detail |
---|
protected org.apache.hadoop.fs.FSDataInputStream istream
HFile
protected Compression.Algorithm compressAlgo
HFile
protected long fileSize
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public HFileBlock.AbstractFSReader(org.apache.hadoop.fs.FSDataInputStream istream, Compression.Algorithm compressAlgo, long fileSize)
Method Detail |
---|
public HFileBlock.BlockIterator blockRange(long startOffset, long endOffset)
HFileBlock.FSReader
HFile
.
The iterator returns blocks starting with offset such that offset <=
startOffset < endOffset.
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(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 read
IOException
protected void decompress(byte[] dest, int destOffset, InputStream bufferedBoundedStream, int compressedSize, int uncompressedSize) throws IOException
dest
- destOffset
- bufferedBoundedStream
- a stream to read compressed data from, bounded to the exact
amount of compressed datacompressedSize
- compressed data size, header not includeduncompressedSize
- uncompressed data size, header not included
IOException
protected InputStream createBufferedBoundedStream(long offset, int size, boolean pread)
offset
- the starting file offset the bounded stream reads fromsize
- the size of the segment of the file the stream should readpread
- whether to use position reads
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |