private void putEntry(DirectBytes keyBytes, V value, int hash2) { int pos = nextFree(); long offset = entriesOffset + pos * builder.entrySize(); tmpBytes.storePositionAndSize(bytes, offset, builder.entrySize()); long keyLength = keyBytes.remaining(); tmpBytes.writeStopBit(keyLength); tmpBytes.write(keyBytes); tmpBytes.position(align(tmpBytes.position())); appendInstance(keyBytes, value); // add to index if successful. hashLookup.put(hash2, pos); }
private V acquireEntry(DirectBytes keyBytes, V value, int hash2) { int pos = nextFree(); long offset = entriesOffset + pos * builder.entrySize(); tmpBytes.storePositionAndSize(bytes, offset, builder.entrySize()); long keyLength = keyBytes.remaining(); tmpBytes.writeStopBit(keyLength); tmpBytes.write(keyBytes); tmpBytes.position(align(tmpBytes.position())); tmpBytes.zeroOut(tmpBytes.position(), tmpBytes.limit()); V v = readObjectUsing(value, offset + tmpBytes.position()); // add to index if successful. hashLookup.put(hash2, pos); return v; }