private void log ( String value ) throws IOException { if ( value == null ) { log . write ( "(String)null" ) ; } else { log . write ( ' ' ) ; for ( int i = 0 , len = value . length ( ) ; i < len ; i ++ ) { char ch = value . charAt ( i ) ; if ( ch == ' ' ) log . write ( "\\t" ) ; else if ( ch == ' ' ) log . write ( "\\b" ) ; else if ( ch == ' ' ) log . write ( "\\n" ) ; else if ( ch == ' ' ) log . write ( "\\r" ) ; else if ( ch == ' ' ) log . write ( "\\f" ) ; else if ( ch == ' ' ) log . write ( "\\\\" ) ; else if ( ch == ' ' ) log . write ( "\\\"" ) ; else if ( ch < ' ' ) { log . write ( "\\u" ) ; String hex = Integer . toHexString ( ch ) ; for ( int l = hex . length ( ) ; l < 4 ; l ++ ) log . write ( ' ' ) ; log . write ( hex ) ; } else { log . write ( ch ) ; } } log . write ( ' ' ) ; } }
Writes a String unicode escaping as needed .