//字节流 行读取 String File file = new File("C:\\Users\\Administrator\\Desktop\\test.txt"); BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); String tempString = null; while( (tempString = bufferedReader.readLine()) != null){ System.out.print(tempString); } bufferedReader.close(); //字节读取 int FileInputStream fileInputStream = new FileInputStream(("C:\\Users\\Administrator\\Desktop\\test.txt")); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8"); int temp; while((temp = inputStreamReader.read()) != -1){ System.out.print((char)temp); } inputStreamReader.close();
基础