org.apache.hadoop.hbase.io.hfile
Class HFileReaderV1.ScannerV1

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
      extended by org.apache.hadoop.hbase.io.hfile.HFileReaderV1.AbstractScannerV1
          extended by org.apache.hadoop.hbase.io.hfile.HFileReaderV1.ScannerV1
All Implemented Interfaces:
HFileScanner
Enclosing class:
HFileReaderV1

protected static class HFileReaderV1.ScannerV1
extends HFileReaderV1.AbstractScannerV1

Implementation of HFileScanner interface.


Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderV1.AbstractScannerV1
currBlock
 
Fields inherited from class org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
blockBuffer, blockFetches, cacheBlocks, currKeyLen, currMemstoreTS, currMemstoreTSLen, currValueLen, isCompaction, pread
 
Constructor Summary
HFileReaderV1.ScannerV1(HFileReaderV1 reader, boolean cacheBlocks, boolean pread, boolean isCompaction)
           
 
Method Summary
protected  int blockSeek(byte[] key, int offset, int length, boolean seekBefore)
          Within a loaded block, seek looking for the first key that is smaller than (or equal to?) the key we are interested in.
 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  void loadBlock(int bloc, boolean rewind)
           
 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.HFileReaderV1.AbstractScannerV1
reseekTo, seekBefore, 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

HFileReaderV1.ScannerV1

public HFileReaderV1.ScannerV1(HFileReaderV1 reader,
                               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.

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
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

blockSeek

protected int blockSeek(byte[] key,
                        int offset,
                        int length,
                        boolean seekBefore)
Description copied from class: HFileReaderV1.AbstractScannerV1
Within a loaded block, seek looking for the first key that is smaller than (or equal to?) the key we are interested in. A note on the seekBefore - if you have seekBefore = true, AND the first key in the block = key, then you'll get thrown exceptions.

Specified by:
blockSeek in class HFileReaderV1.AbstractScannerV1
Parameters:
key - to find
seekBefore - find the key before the exact match.
Returns:

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

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

loadBlock

protected void loadBlock(int bloc,
                         boolean rewind)
                  throws IOException
Specified by:
loadBlock in class HFileReaderV1.AbstractScannerV1
Throws:
IOException


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