commit 931400ec72c163545a5969101ed2d1616a7377d7 Author: Ryan Rawson Date: Wed Sep 1 15:30:15 2010 -0700 this is oddly enough faster than getInt() diff --git a/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java index 3966108..e611c3b 100644 --- a/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -1194,7 +1194,8 @@ public class HFile { return null; } return new KeyValue(this.block.array(), - this.block.arrayOffset() + this.block.position() - 8); + this.block.arrayOffset() + this.block.position() - 8, + this.currKeyLen+this.currValueLen+8); } public ByteBuffer getKey() { @@ -1238,16 +1239,22 @@ public class HFile { return false; } block = reader.readBlock(this.currBlock, this.cacheBlocks, this.pread); - currKeyLen = block.getInt(); - currValueLen = block.getInt(); + currKeyLen = Bytes.toInt(block.array(), block.arrayOffset()+block.position(), 4); + currValueLen = Bytes.toInt(block.array(), block.arrayOffset()+block.position()+4, 4); + block.position(block.position()+8); +// currKeyLen = block.getInt(); +// currValueLen = block.getInt(); blockFetches++; return true; } // LOG.debug("rem:" + block.remaining() + " p:" + block.position() + // " kl: " + currKeyLen + " kv: " + currValueLen); + currKeyLen = Bytes.toInt(block.array(), block.arrayOffset()+block.position(), 4); + currValueLen = Bytes.toInt(block.array(), block.arrayOffset()+block.position()+4, 4); + block.position(block.position()+8); - currKeyLen = block.getInt(); - currValueLen = block.getInt(); +// currKeyLen = block.getInt(); +// currValueLen = block.getInt(); return true; }