Here you can find the source of utf8Reader(InputStream in)
Parameter | Description |
---|---|
in | the input stream to read from |
public static Reader utf8Reader(InputStream in)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.Charset; public class Main { private static final Charset UTF8 = Charset.forName("UTF-8"); /**/*from w w w .j a v a 2 s . co m*/ * Creates a reader whose character encoding is set to "UTF-8". * @param in the input stream to read from * @return the reader */ public static Reader utf8Reader(InputStream in) { return new InputStreamReader(in, UTF8); } /** * Creates a reader whose character encoding is set to "UTF-8". * @param file the file to read from * @return the reader * @throws FileNotFoundException if the file can't be read */ public static Reader utf8Reader(File file) throws FileNotFoundException { return utf8Reader(new FileInputStream(file)); } }