- try {
- int length = buffer.getInt();
-
- // If the length is non-zero, read the entry.
- while (0 < length && length <= maxEntrySize && (index == 0 || nextIndex <= index)) {
-
- // Read the checksum of the entry.
- final long checksum = buffer.getInt() & 0xFFFFFFFFL;
-
- // Compute the checksum for the entry bytes.
- final CRC32 crc32 = new CRC32();
- ByteBuffer slice = buffer.slice();
- slice.limit(length);
- crc32.update(slice);
-
- // If the stored checksum equals the computed checksum, return the entry.
- if (checksum == crc32.getValue()) {
- slice.rewind();
- final E entry = namespace.deserialize(slice);
- lastEntry = new Indexed<>(nextIndex, entry, length);
- this.index.index(nextIndex, position);
- nextIndex++;
- } else {
- break;
- }
+ // Read the checksum of the entry.
+ final long checksum = buffer.getInt(currentPosition + Integer.BYTES);