protected int findSeparator()

in commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/MultipartInput.java [759:773]


    protected int findSeparator() {
        var bufferPos = this.head;
        var tablePos = 0;
        while (bufferPos < this.tail) {
            while (tablePos >= 0 && buffer[bufferPos] != boundary[tablePos]) {
                tablePos = boundaryTable[tablePos];
            }
            bufferPos++;
            tablePos++;
            if (tablePos == boundaryLength) {
                return bufferPos - boundaryLength;
            }
        }
        return -1;
    }