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();
}

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 .
