@Override public long count(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = newCursor(Transaction.BOGUS); TreeCursor high = null; try { if (highKey != null) { high = newCursor(Transaction.BOGUS); high.mKeyOnly = true; high.find(highKey); if (high.mKey == null) { // Found nothing. return 0; } } return cursor.count(lowKey, high); } finally { cursor.reset(); if (high != null) { high.reset(); } } }
@Override public long count(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); TreeCursor high = null; try { if (highKey != null) { high = new TreeCursor(this, Transaction.BOGUS); high.autoload(false); high.find(highKey); if (high.mKey == null) { // Found nothing. return 0; } } return cursor.count(lowKey, high); } finally { cursor.reset(); if (high != null) { high.reset(); } } }
@Override public long count(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); TreeCursor high = null; try { if (highKey != null) { high = new TreeCursor(this, Transaction.BOGUS); high.autoload(false); high.find(highKey); if (high.mKey == null) { // Found nothing. return 0; } } return cursor.count(lowKey, high); } finally { cursor.reset(); if (high != null) { high.reset(); } } }