@Override
  public int getCapacity(int record) throws IOException {
    int currentValue = myStorage.getInt(getOffset(record, SIZE_AND_CAPACITY_OFFSET));
    if (currentValue < 0) {
      // read capacity from indirect record
      return myStorage.getInt(getOffset(-currentValue, CAPACITY_OFFSET_IN_INDIRECT_RECORD));
    }
    return (currentValue & CAPACITY_MASK) >> CAPACITY_SHIFT;
  }
@Override
  public int getCapacity(int record)