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;
    }
public static Writer createWriter ( OutputStream outputStream , String encoding ) { String updatedEncoding = IOHelper . getEncodingToUse ( encoding ) ; 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.

@param   outputStream
The output stream
@param   encoding
The encoding used by the writer (null for default system encoding)
@return  The writer