使用Java写入txt文件时是否有行限制?
我试图通过将http响应写入txt文件来记录它们
我在Java中使用FileWriter,但不幸的是,当超过行数(例如1000行)或txt文件大小(例如80kb)时,它会自动删除以前的内容并写入新内容
每次超过限制时都会发生这种情况
try{
File file = new File("response.txt");
file.createNewFile();
FileWriter writer = new FileWriter(file,true);
writer.write(+System.currentTimeMillis()+"\t"+response+"\n");
writer.flush();
writer.close();}
catch(IOException ioe){
System.out.println("\nError");}
共 (0) 个答案