package com.zhiru;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class WriteToFile {
private String fName;
WriteToFile(String f) {
fName = f;
}
public void writeToFile(String what) throws IOException {
//想文件中追加新的内容
OutputStream out = new FileOutputStream(new File(fName),true);
byte[] b = what.getBytes();
out.write(b);
out.flush();
out.close();
}
}
写入内容到文件中
最新推荐文章于 2023-09-14 11:04:01 发布