private int parseEndOfLine()

in commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/AbstractFileUpload.java [385:397]


    private int parseEndOfLine(final String headerPart, final int end) {
        var index = end;
        for (;;) {
            final var offset = headerPart.indexOf('\r', index);
            if (offset == -1 || offset + 1 >= headerPart.length()) {
                throw new IllegalStateException("Expected headers to be terminated by an empty line.");
            }
            if (headerPart.charAt(offset + 1) == '\n') {
                return offset;
            }
            index = offset + 1;
        }
    }