gpt4 book ai didi

JAVA我做错了什么,我想要线

转载 作者:行者123 更新时间:2023-11-29 03:26:47 24 4
gpt4 key购买 nike

<分区>

我正在尝试制作更改日志,因此我需要在一些句子之间留一行。我只有这个,但它似乎不起作用。谁能帮帮我?

@Test
public void addLine() {
File temp;
try {
temp = File.createTempFile("app.log", ".tmp", new File("."));
File appLog = new File("app.log");
try (BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
BufferedReader br = new BufferedReader(new FileReader(
appLog))) {
String line;
while ((line = br.readLine()) != null) {
bw.write(line);
bw.newLine();
if ("2 A".equals(line)) {
bw.write("New Line!");
bw.newLine();
}
}
appLog.delete();
temp.renameTo(appLog);
}
} catch (IOException e) {
e.printStackTrace();
}
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com