@ Override public void writeOutput ( VisualizerInput input , OutputStream outstream ) { try { OutputStreamWriter writer = new OutputStreamWriter ( outstream , getCharacterEncoding ( ) ) ; writeOutput ( input , writer ) ; writer . flush ( ) ; } catch ( IOException ex ) { log . error ( "Exception when writing visualizer output." , ex ) ; StringWriter strWriter = new StringWriter ( ) ; ex . printStackTrace ( new PrintWriter ( strWriter ) ) ; try { outstream . write ( strWriter . toString ( ) . getBytes ( "UTF-8" ) ) ; } catch ( IOException ex1 ) { log . error ( null , ex ) ; } } }
Will create a Writer of the outstream .