public void write ( Reader reader , boolean escape , boolean noBackslashEscapes ) throws IOException { char [ ] buffer = new char [ 4096 ] ; int len ; while ( ( len = reader . read ( buffer ) ) >= 0 ) { byte [ ] data = new String ( buffer , 0 , len ) . getBytes ( "UTF-8" ) ; if ( escape ) { writeBytesEscaped ( data , data . length , noBackslashEscapes ) ; } else { write ( data ) ; } } }
Write reader into socket .