@Override
    public CharSequence subSequence(int start, int end) {
        if (start < 0)
            throw new IndexOutOfBoundsException();
        if (end < start)
            throw new IndexOutOfBoundsException();
        if (end > length())
            throw new IndexOutOfBoundsException();
        try {
            return new SQLDocumentCharacterIterator(document, getBeginIndex() + start, getBeginIndex() + end);
        } catch (BadLocationException ex) {
            throw new IndexOutOfBoundsException();
        }
    }
Creates an iterator for the document contents from <code>first</code> (inclusive) to
<code>last</code> (exclusive).

@param document the document backing this iterator
@param first    the first character to consider
@param last     the last character index to consider
@throws BadLocationException if the indices are out of bounds
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLDocumentCharacterIterator.java