import java.util.LinkedList;public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new FileReader("d:/1.txt"));String line = null;LinkedList<String> list = new LinkedList<String>();while ((line = reader.readLine(...
使用Java 11java.nio.file.Files.readString()oldContent = Files.readString(Paths.get(templatePath));
import java.io.InputStreamReader;/ Created by Administrator on 2016/1/8./ public class TestReadTxt { public static void readTxtFile(String filePath){ try { String encoding="GBK";File file=new File(filePath);if(file.isFile() && file.exists()){ //判断文件是否存在 InputStream...
File filePath = new File("D:\\AB.txt");BufferedReader br=new BufferedReader(new FileReader(filePath));while ((String s = br.readLine()) != null) { System.out.println(s + "\r\n");} ///主要的代码应该差不多,你自己再修改一下就OK了......