void escape() throws IOException {
  int end=chars.length();
  if (end == 0) {
    return;
  }
  int pos=0;
  if (otherEscapes.isEmpty()) {
    for (int i=0; i < end; ++i) {
      if (escapeOneChar(pos,i,chars.charAt(i))) {
        pos=i + 1;
      }
    }
  }
 else {
    int codepoint=Character.codePointAt(chars,0);
    for (int i=0; i < end; ) {
      int charCount=Character.charCount(codepoint);
      int i2=i + charCount;
      int nextCodepoint=i2 < end ? Character.codePointAt(chars,i2) : -1;
      if (escapeOneCodepoint(pos,i,codepoint,nextCodepoint)) {
        pos=i2;
      }
      i=i2;
      codepoint=nextCodepoint;
    }
  }
  out.append(chars,pos,end);
}

void escape ( ) throws IOException { int end = chars . length ( ) ; if ( end == 0 ) { return ; } int pos = 0 ; if ( otherEscapes . isEmpty ( ) ) { for ( int i = 0 ; i < end ; ++ i ) { if ( escapeOneChar ( pos , i , chars . charAt ( i ) ) ) { pos = i + 1 ; } } } else { int codepoint = Character . codePointAt ( chars , 0 ) ; for ( int i = 0 ; i < end ; ) { int charCount = Character . charCount ( codepoint ) ; int i2 = i + charCount ; int nextCodepoint = i2 < end ? Character . codePointAt ( chars , i2 ) : - 1 ; if ( escapeOneCodepoint ( pos , i , codepoint , nextCodepoint ) ) { pos = i2 ; } i = i2 ; codepoint = nextCodepoint ; } } out . append ( chars , pos , end ) ; }
treats chars as plain text , and appends to out the escaped version .
