code: protected int calculateLineIndentationLevel(final ParserData parserData, final String line,
              int lineNumber) throws IndentationException {
          char[] lineCharArray = line.toCharArray();
          int indentationCount = 0;
          // Count the amount of whitespace characters before any text to determine the level
          if (Character.isWhitespace(lineCharArray[0])) {
              for (char c : lineCharArray) {
                  if (Character.isWhitespace(c)) {
                      indentationCount++;
                  } else {
                      break;
                  }
              }
              if (indentationCount % parserData.getIndentationSize() != 0) {
                  throw new IndentationException(format(ProcessorConstants.ERROR_INCORRECT_INDENTATION_MSG, lineNumber, line.trim()));
              }
          }
  
          return indentationCount / parserData.getIndentationSize();
      }
docs: Calculates the indentation level of a line using the amount of whitespace and the parsers indentation size setting.
  
  @param parserData
  @param line       The line to calculate the indentation for.
  @return The lines indentation level.
  @throws IndentationException Thrown if the indentation for the line isn't valid.