private void readDataFromStreamToBuffer(@NotNull InputStream input) throws IOException {
    int bytesRead = input.readNBytes(buffer, 0, buffer.length);
    if (bytesRead < buffer.length) {
      throw new IOException("Unexpected end of stream (" + bytesRead + " bytes read; " + buffer.length +
                            " expected; totalBlocks = " + roundedUpTotalBlocks + "; totalStreamLength = " + totalStreamLength + ")");
    }
  }
private void readDataFromStreamToBuffer(@NotNull InputStream input)