System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len);  txt.count = len; txt.offset = 0;
if ((where < gapStart) && ((gapStart - where) < len)) {  char[] copy = new char[len]; int lenFirst = gapStart - where; System.arraycopy(buffer, where, copy, 0, lenFirst); System.arraycopy(buffer, gapEnd, copy, lenFirst, len - lenFirst); txt.array = copy; txt.offset = 0; txt.count = len; } else {   txt.array = buffer; if (where < gapStart) txt.offset = where; else txt.offset = where + (gapEnd - gapStart); txt.count = len; }
  public void getChars(int where, int len, Segment txt)    throws BadLocationException  {    txt.array = new char[len];    System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len);    txt.count = len;    txt.offset = 0;  }