public void replaceBytes(int offset,int len,byte[] bytes){
  byte[] removed=null;
  if (len > 0) {
    removed=new byte[len];
    doc.remove(offset,len,removed);
  }
  byte[] added=null;
  if (bytes != null && bytes.length > 0) {
    doc.insertBytes(offset,bytes);
    added=(byte[])bytes.clone();
  }
  if (removed != null || added != null) {
    undoManager.addEdit(new BytesReplacedUndoableEdit(offset,removed,added));
    fireTableDataChanged();
    int addCount=added == null ? 0 : added.length;
    int remCount=removed == null ? 0 : removed.length;
    editor.fireHexEditorEvent(offset,addCount,remCount);
  }
}

public void replaceBytes ( int offset , int len , byte [ ] bytes ) { byte [ ] removed = null ; if ( len > 0 ) { removed = new byte [ len ] ; doc . remove ( offset , len , removed ) ; } byte [ ] added = null ; if ( bytes != null && bytes . length > 0 ) { doc . insertBytes ( offset , bytes ) ; added = ( byte [ ] ) bytes . clone ( ) ; } if ( removed != null || added != null ) { undoManager . addEdit ( new BytesReplacedUndoableEdit ( offset , removed , added ) ) ; fireTableDataChanged ( ) ; int addCount = added == null ? 0 : added . length ; int remCount = removed == null ? 0 : removed . length ; editor . fireHexEditorEvent ( offset , addCount , remCount ) ; } }
replaces bytes in the document .
