Here you can find the source of asPrintWriterUTF8(OutputStream out)
static public PrintWriter asPrintWriterUTF8(OutputStream out)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; import java.nio.charset.Charset; public class Main { static Charset utf8 = null; /** Create a print writer that uses UTF-8 encoding */ static public PrintWriter asPrintWriterUTF8(OutputStream out) { return new PrintWriter(asUTF8(out)); }//from w w w . j a va 2 s .c o m /** Create a reader that uses UTF-8 encoding */ static public Reader asUTF8(InputStream in) { return new InputStreamReader(in, utf8.newDecoder()); } /** Create a writer that uses UTF-8 encoding */ static public Writer asUTF8(OutputStream out) { return new OutputStreamWriter(out, utf8.newEncoder()); } }