Here you can find the source of asUTF8(InputStream in)
static public Reader asUTF8(InputStream in)
//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.Reader; import java.io.Writer; import java.nio.charset.Charset; public class Main { static Charset utf8 = null; /** Create a reader that uses UTF-8 encoding */ static public Reader asUTF8(InputStream in) { return new InputStreamReader(in, utf8.newDecoder()); }//from ww w. ja v a 2 s .c om /** Create a writer that uses UTF-8 encoding */ static public Writer asUTF8(OutputStream out) { return new OutputStreamWriter(out, utf8.newEncoder()); } }