private void refill() throws IOException {
  offset+=usableLength;
  int leftover=length - usableLength;
  System.arraycopy(buffer,usableLength,buffer,0,leftover);
  int requested=buffer.length - leftover;
  int returned=read(input,buffer,leftover,requested);
  length=returned < 0 ? leftover : returned + leftover;
  if (returned < requested)   usableLength=length;
 else {
    usableLength=findSafeEnd();
    if (usableLength < 0)     usableLength=length;
  }
  wrapper.setText(buffer,0,Math.max(0,usableLength));
  iterator.setText(wrapper);
}

private void refill ( ) throws IOException { offset += usableLength ; int leftover = length - usableLength ; System . arraycopy ( buffer , usableLength , buffer , 0 , leftover ) ; int requested = buffer . length - leftover ; int returned = read ( input , buffer , leftover , requested ) ; length = returned < 0 ? leftover : returned + leftover ; if ( returned < requested ) usableLength = length ; else { usableLength = findSafeEnd ( ) ; if ( usableLength < 0 ) usableLength = length ; } wrapper . setText ( buffer , 0 , Math . max ( 0 , usableLength ) ) ; iterator . setText ( wrapper ) ; }
refill the buffer , accumulating the offset and setting usablelength to the last unambiguous break position
