public KeyValIter binaryKeys() {
return new KeyValIter() {
long off = FILE_HEADER_LEN;
int elemCount = 0;
BytezByteSource byteIter = new BytezByteSource(memory,0,0);
BytezByteSource byteVal = new BytezByteSource(memory,0,0);
long valueAddress;
@Override
public boolean hasNext() {
return elemCount < numElem;
}
@Override
public ByteSource next() {
int len = getLenFromHeader(off);
int contentLen = getContentLenFromHeader(off);
boolean removed = memory.get(off+4) != 0;
off+= getHeaderLen();
while ( removed ) {
off += len;
len = getLenFromHeader(off);
contentLen = getContentLenFromHeader(off);
removed = memory.get(off+4) != 0;
off+= getHeaderLen();
}
elemCount++;
valueAddress = off;
byteVal.setOff(off);
byteVal.setLen(contentLen);
byteIter.setOff(off-getHeaderLen()+16);
byteIter.setLen(keyLen);
off+=len;
return byteIter;
}