private void ensureCapacity(int inputIdToStore) throws StorageException {
      final int elementsToStore = inputIdToStore + 1;
      if (myElementsCount >= elementsToStore) {
        return;
      }
      try {
        final int zeroBufSize = DEFAULT_FILE_ALLOCATION_BYTES;
        ByteBuffer zeroBuf = ByteBuffer.allocate(zeroBufSize);
        while (myElementsCount < elementsToStore) {
          myFileChannel.write(zeroBuf, offsetInFile(myElementsCount) + zeroBuf.position());
          if (!zeroBuf.hasRemaining()) {
            zeroBuf.position(0);
            //noinspection NonAtomicOperationOnVolatileField
            myElementsCount += zeroBufSize / ELEMENT_BYTES;
          }
        }
      }
      catch (IOException e) {
        throw closeWithException(new StorageException(e));
      }
    }
private void ensureCapacity(int inputIdToStore)