docs: protected void checkBounds(int index) throws IOException {
          assertInput();
          if (index < getMinIndex()) {
              throw new IndexOutOfBoundsException("index < minIndex");
          }
  
          int numImages = getNumImages(false);
          if (numImages != -1 && index >= numImages) {
              throw new IndexOutOfBoundsException("index >= numImages (" + index + " >= " + numImages + ")");
          }
      }