tmp
This commit is contained in:
@@ -33,6 +33,24 @@ public class FileUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 把字符串追加保存成文件
|
||||
*/
|
||||
public static void saveAddStringToFile(File dir, String content, String fileName) {
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
FileOutputStream os = new FileOutputStream(new File(dir, fileName));
|
||||
writer = new PrintWriter(os);
|
||||
writer.append(content);
|
||||
writer.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从文件读取字符串
|
||||
|
||||
Reference in New Issue
Block a user