Here you can find the source of getBufferedUTF8Reader(InputStream inputStream)
Parameter | Description |
---|---|
inputStream | InputStream in UTF-8 encoding |
public static BufferedReader getBufferedUTF8Reader(InputStream inputStream)
//package com.java2s; /** /*from ww w. ja v a 2 s. c o m*/ This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga) Some utility methods for arrays */ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; public class Main { /** * Creates a BufferedReader for UTF-8-encoded files * * @param file File in UTF-8 encoding * @return BufferedReader for file * @throws FileNotFoundException */ public static BufferedReader getBufferedUTF8Reader(File file) throws FileNotFoundException { return new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); } /** * Creates a BufferedReader for UTF-8-encoded files * * @param fileName Path to file in UTF-8 encoding * @return BufferedReader for file * @throws FileNotFoundException */ public static BufferedReader getBufferedUTF8Reader(String fileName) throws FileNotFoundException { return new BufferedReader(new InputStreamReader(new FileInputStream(fileName), Charset.forName("UTF-8"))); } /** * Creates a BufferedReader the UTF-8-encoded InputStream * * @param inputStream InputStream in UTF-8 encoding * @return BufferedReader for inputStream */ public static BufferedReader getBufferedUTF8Reader(InputStream inputStream) { return new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); } }