public static Writer createWriter ( OutputStream outputStream , String encoding ) { //get encoding String updatedEncoding = IOHelper . getEncodingToUse ( encoding ) ; //create writer Writer writer = null ; try { writer = new OutputStreamWriter ( outputStream , updatedEncoding ) ; } catch ( UnsupportedEncodingException exception ) { throw new FaxException ( "Unable to create writer, unsupported encoding: " + encoding , exception ) ; } return writer ; }
This function creates and returns a new writer for the provided output stream .