org.apache.hadoop.hbase.io.hfile
Class HFileReaderV2.EncodedScannerV2

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
      extended by org.apache.hadoop.hbase.io.hfile.HFileReaderV2.AbstractScannerV2
          extended by org.apache.hadoop.hbase.io.hfile.HFileReaderV2.EncodedScannerV2
All Implemented Interfaces:
HFileScanner
Direct Known Subclasses:
HFileReaderV3.EncodedScannerV3
Enclosing class:
HFileReaderV2

protected static class HFileReaderV2.EncodedScannerV2
extends HFileReaderV2.AbstractScannerV2

ScannerV2 that operates on encoded data blocks.


Field Summary
protected  HFileContext meta
           
 
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderV2.AbstractScannerV2
block, nextIndexedKey
 
Fields inherited from class org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
blockBuffer, blockFetches, cacheBlocks, currKeyLen, currMemstoreTS, currMemstoreTSLen, currValueLen, isCompaction, pread, reader
 
Constructor Summary
HFileReaderV2.EncodedScannerV2(HFileReaderV2 reader, boolean cacheBlocks, boolean pread, boolean isCompaction, HFileContext meta)
           
 
Method Summary
 int compareKey(KeyValue.KVComparator comparator, byte[] key, int offset, int length)
          Compare the given key against the current key
protected  ByteBuffer getFirstKeyInBlock(HFileBlock curBlock)
           
 ByteBuffer getKey()
          Gets a buffer view to the current key.
 String getKeyString()
          Convenience method to get a copy of the key as a string - interpreting the bytes as UTF8.
 KeyValue getKeyValue()
           
 ByteBuffer getValue()
          Gets a buffer view to the current value.
 String getValueString()
          Convenience method to get a copy of the value as a string - interpreting the bytes as UTF8.
 boolean isSeeked()
           
protected  int loadBlockAndSeekToKey(HFileBlock seekToBlock, byte[] nextIndexedKey, boolean rewind, byte[] key, int offset, int length, boolean seekBefore)
           
 boolean next()
          Scans to the next entry in the file.
 boolean seekTo()
          Positions this scanner at the start of the file.
 
Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderV2.AbstractScannerV2
getNextIndexedKey, readNextDataBlock, reseekTo, seekBefore, seekTo, seekTo
 
Methods inherited from class org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
assertSeeked, getReader, reseekTo, seekBefore, seekTo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

meta

protected final HFileContext meta
Constructor Detail

HFileReaderV2.EncodedScannerV2

public HFileReaderV2.EncodedScannerV2(HFileReaderV2 reader,
                                      boolean cacheBlocks,
                                      boolean pread,
                                      boolean isCompaction,
                                      HFileContext meta)
Method Detail

isSeeked

public boolean isSeeked()
Specified by:
isSeeked in interface HFileScanner
Overrides:
isSeeked in class AbstractHFileReader.Scanner
Returns:
True is scanner has had one of the seek calls invoked; i.e. HFileScanner.seekBefore(byte[]) or HFileScanner.seekTo() or HFileScanner.seekTo(byte[]). Otherwise returns false.

seekTo

public boolean seekTo()
               throws IOException
Description copied from interface: HFileScanner
Positions this scanner at the start of the file.

Returns:
False if empty file; i.e. a call to next would return false and the current key and value are undefined.
Throws:
IOException

next

public boolean next()
             throws IOException
Description copied from interface: HFileScanner
Scans to the next entry in the file.

Returns:
Returns false if you are at the end otherwise true if more in file.
Throws:
IOException

getKey

public ByteBuffer getKey()
Description copied from interface: HFileScanner
Gets a buffer view to the current key. You must call HFileScanner.seekTo(byte[]) before this method.

Returns:
byte buffer for the key. The limit is set to the key size, and the position is 0, the start of the buffer view.

compareKey

public int compareKey(KeyValue.KVComparator comparator,
                      byte[] key,
                      int offset,
                      int length)
Description copied from class: HFileReaderV2.AbstractScannerV2
Compare the given key against the current key

Specified by:
compareKey in class HFileReaderV2.AbstractScannerV2
Returns:
-1 is the passed key is smaller than the current key, 0 if equal and 1 if greater

getValue

public ByteBuffer getValue()
Description copied from interface: HFileScanner
Gets a buffer view to the current value. You must call HFileScanner.seekTo(byte[]) before this method.

Returns:
byte buffer for the value. The limit is set to the value size, and the position is 0, the start of the buffer view.

getKeyValue

public KeyValue getKeyValue()
Returns:
Instance of KeyValue.

getKeyString

public String getKeyString()
Description copied from interface: HFileScanner
Convenience method to get a copy of the key as a string - interpreting the bytes as UTF8. You must call HFileScanner.seekTo(byte[]) before this method.

Returns:
key as a string

getValueString

public String getValueString()
Description copied from interface: HFileScanner
Convenience method to get a copy of the value as a string - interpreting the bytes as UTF8. You must call HFileScanner.seekTo(byte[]) before this method.

Returns:
value as a string

getFirstKeyInBlock

protected ByteBuffer getFirstKeyInBlock(HFileBlock curBlock)
Specified by:
getFirstKeyInBlock in class HFileReaderV2.AbstractScannerV2

loadBlockAndSeekToKey

protected int loadBlockAndSeekToKey(HFileBlock seekToBlock,
                                    byte[] nextIndexedKey,
                                    boolean rewind,
                                    byte[] key,
                                    int offset,
                                    int length,
                                    boolean seekBefore)
                             throws IOException
Specified by:
loadBlockAndSeekToKey in class HFileReaderV2.AbstractScannerV2
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.