JAVA读取单文件内容
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
File file = new File("E:\\learning\\a.txt");//文本地址
StringBuilder sb = new StringBuilder();
String s ="";
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while( (s = br.readLine()) != null) {
sb.append(s + "\n");
}
br.close();
String text = sb.toString();
//str是你想要的东西
System.out.println(text);
}