code: private int updateElementInReadBuffer(Data data, int indexInChunk) {
          workingBuffer.position(indexInChunk);
          int minElement = indexInChunk / gp.getElementSize();
          int numberOfEntries = workingBuffer.limit() / gp.getElementSize();
          byte[] actualKey = data.getKey();
          // binary search
          int maxElement = numberOfEntries - 1;
          int midElement;
          int compare;
          byte[] tmpKey = new byte[actualKey.length];
          while (minElement <= maxElement) {
              midElement = minElement + (maxElement - minElement) / 2;
              indexInChunk = midElement * gp.getElementSize();
              workingBuffer.position(indexInChunk);
              workingBuffer.get(tmpKey);
              compare = KeyUtils.compareKey(actualKey, tmpKey);
              if (compare == 0) {
                  // first read the old element
                  workingBuffer.position(indexInChunk);
                  byte[] b = new byte[gp.getElementSize()];
                  workingBuffer.get(b);
                  @SuppressWarnings("unchecked")
                  Data toUpdate = (Data)prototype.fromByteBuffer(ByteBuffer.wrap(b));
                  // update the old element and write it
                  toUpdate.update(data);
                  workingBuffer.position(indexInChunk);
                  workingBuffer.put(data.toByteBuffer());
                  return indexInChunk;
              } else if (compare < 0) {
                  maxElement = midElement - 1;
              } else {
                  minElement = midElement + 1;
              }
          }
          return -1;
      }
docs: traverses the readBuffer