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

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.ScannerV2
All Implemented Interfaces:
HFileScanner
Enclosing class:
HFileReaderV2

protected static class HFileReaderV2.ScannerV2
extends HFileReaderV2.AbstractScannerV2

Implementation of HFileScanner interface.


Field Summary
 
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
 
Constructor Summary
HFileReaderV2.ScannerV2(HFileReaderV2 r, boolean cacheBlocks, boolean pread, boolean isCompaction)
           
 
Method Summary
 int compareKey(org.apache.hadoop.io.RawComparator<byte[]> 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.
protected  int loadBlockAndSeekToKey(HFileBlock seekToBlock, byte[] nextIndexedKey, boolean rewind, byte[] key, int offset, int length, boolean seekBefore)
           
 boolean next()
          Go to the next key/value in the block section.
 boolean seekTo()
          Positions this scanner at the start of the file.
 
Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderV2.AbstractScannerV2
readNextDataBlock, reseekTo, seekBefore, seekTo, seekTo
 
Methods inherited from class org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
assertSeeked, getReader, isSeeked, reseekTo, seekBefore, seekTo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HFileReaderV2.ScannerV2

public HFileReaderV2.ScannerV2(HFileReaderV2 r,
                               boolean cacheBlocks,
                               boolean pread,
                               boolean isCompaction)
Method Detail

getKeyValue

public KeyValue getKeyValue()
Returns:
Instance of KeyValue.

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(org.apache.hadoop.io.RawComparator<byte[]> 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.

next

public boolean next()
             throws IOException
Go to the next key/value in the block section. Loads the next block if necessary. If successful, getKey() and getValue() can be called.

Returns:
true if successfully navigated to the next key/value
Throws:
IOException

seekTo

public boolean seekTo()
               throws IOException
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

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

getFirstKeyInBlock

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

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


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.