code: private int parseFileIndex(String fileName) {
      Matcher match = null;
      String indexString = null;
      try {
        match = exportPattern.matcher(fileName);
        match.find();
        indexString = match.group(1);
      } catch (Exception e) {
        throw new IllegalStateException(String.format("Failed to parse file '%s'", fileName), e);
      }
      long longValue = Long.parseLong(indexString);
      if (longValue > Integer.MAX_VALUE) {
        throw new IndexOutOfBoundsException(String.format(
            "Invalid fileName '%s'; max allowable index is %d, got %d instead",
            fileName, Integer.MAX_VALUE, longValue));
      }
      return (int) longValue;
    }
docs: Parses the numerical index out of a String which matches exportPattern; the exportPattern
  should have been compiled from a regex that looks like "data-(\d+).json".
  
  @throws IndexOutOfBoundsException if the parsed value is greater than Integer.MAX_VALUE.