import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ReadFile {
public static void main(String[] args) throws IOException{
File file = new File("D:\\test.txt");
FileReader fileReader = new FileReader(file);
String sx = fileReader.getEncoding();
FileInputStream fileInputStream = new FileInputStream(file);
InputStreamReader inputStramReader = new InputStreamReader(fileInputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStramReader);
String fileContent = "";
String line = null;
while ((line = bufferedReader.readLine()) != null) {
fileContent += line + "\n";
}
}
}