Here you can find the source of getUTF8Reader(InputStream f)
private static Reader getUTF8Reader(InputStream f) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; public class Main { private static Reader getUTF8Reader(InputStream f) throws IOException { BufferedInputStream bis = new BufferedInputStream(f); assert bis.markSupported(); bis.mark(3);// w ww . ja v a2s . c om boolean reset = true; byte[] t = new byte[3]; bis.read(t); if (t[0] == ((byte) 0xef) && t[1] == ((byte) 0xbb) && t[2] == ((byte) 0xbf)) { reset = false; } if (reset) { bis.reset(); } return new InputStreamReader(bis, "UTF-8"); } }