public final void translate(final CharSequence input,final Writer out) throws IOException {
  if (out == null) {
    throw new IllegalArgumentException("The Writer must not be null");
  }
  if (input == null) {
    return;
  }
  int pos=0;
  final int len=input.length();
  while (pos < len) {
    final int consumed=translate(input,pos,out);
    if (consumed == 0) {
      char c1=input.charAt(pos);
      out.write(c1);
      pos++;
      if (Character.isHighSurrogate(c1) && pos < len) {
        char c2=input.charAt(pos);
        if (Character.isLowSurrogate(c2)) {
          out.write(c2);
          pos++;
        }
      }
      continue;
    }
    for (int pt=0; pt < consumed; pt++) {
      pos+=Character.charCount(Character.codePointAt(input,pos));
    }
  }
}

public final void translate ( final CharSequence input , final Writer out ) throws IOException { if ( out == null ) { throw new IllegalArgumentException ( "The Writer must not be null" ) ; } if ( input == null ) { return ; } int pos = 0 ; final int len = input . length ( ) ; while ( pos < len ) { final int consumed = translate ( input , pos , out ) ; if ( consumed == 0 ) { char c1 = input . charAt ( pos ) ; out . write ( c1 ) ; pos ++ ; if ( Character . isHighSurrogate ( c1 ) && pos < len ) { char c2 = input . charAt ( pos ) ; if ( Character . isLowSurrogate ( c2 ) ) { out . write ( c2 ) ; pos ++ ; } } continue ; } for ( int pt = 0 ; pt < consumed ; pt ++ ) { pos += Character . charCount ( Character . codePointAt ( input , pos ) ) ; } } }
translate an input onto a writer . this is intentionally final as its algorithm is tightly coupled with the abstract method of this class .
