public void replace(String replaceString, boolean isHexString)
    {
        handleSelectedPreModify();
        byte[] replaceData = replaceString.getBytes(Charset.defaultCharset());
        if (isHexString) {
            replaceData = hexStringToByte(replaceString);
        }
        ByteBuffer newSelection = ByteBuffer.wrap(replaceData);
        if (isInserting) {
            content.insert(newSelection, startPosition);
        } else {
            newSelection.limit((int) Math.min(newSelection.limit(), content.length() - startPosition));
            content.overwrite(newSelection, startPosition);
        }
        endPosition = startPosition + newSelection.limit() - newSelection.position();
        caretStickToStart = false;
        redrawTextAreas(true);
        restoreStateAfterModify();
    }
Replaces the selection. The result depends on which insertion mode is currently active:
Insert mode replaces the selection with the replaceString or, if there is no selection, inserts
at the current caret offset.
Overwrite mode replaces contents at the current selection start.

@param replaceString the new string
@param isHexString   consider the literal as an hex string (ie. "0fdA1"). Used for binary finds.
                     Will replace full bytes only, odd number of hex characters will have a leading '0' added.
plugins/org.jkiss.dbeaver.ui.editors.hex/src/org/jkiss/dbeaver/ui/editors/binary/HexEditControl.java