private static int indexOfNewline(char[] input, int offset, int contentLength) {
    for (int i = offset; i < contentLength; i++) {
      char character = input[i];
      if (character == '\n' || character == '\r') return i;
    }
    return -1;
  }
private static int indexOfNewline(char[] input, int offset, int contentLength)