public Number[] getNextMatch()
        throws IOException
    {
        stopSearching = false;
        populatePart();
        findAllMatches();

        while (currentPartFound < 0) { // end of part
            if (nextPart() == null || stopSearching) {
                stopSearching = false;
                return null;  // end of file
            }
            findAllMatches();
        }

        long resultPosition = bufferPosition + currentPartFound;
        int length = currentPartFoundIsUnicode ? literalByteLength : byteFindSequence.length;
        setNewStart(resultPosition + (directionForward ? 1 : length - 1));

        return new Number[]{resultPosition, length};
    }
Get the next position and length of a matching literal

@return an array with 2 elements, the first one a Long (position in the file),
        and the second one an Integer (byte length of the matching literal),
        or null if there are no matches
plugins/org.jkiss.dbeaver.ui.editors.hex/src/org/jkiss/dbeaver/ui/editors/binary/BinaryTextFinder.java