写文件 @param file 需要处理的函数 @param str 添加的子字符串 @return 是否成功
(File file, String str)
| 265 | * @return 是否成功 |
| 266 | */ |
| 267 | public static boolean write(File file, String str) { |
| 268 | AssertUtil.notNull(file, "file is null"); |
| 269 | try ( |
| 270 | RandomAccessFile randomFile = new RandomAccessFile(file, "rw") |
| 271 | ) { |
| 272 | randomFile.writeBytes(str); |
| 273 | return true; |
| 274 | } catch (IOException e) { |
| 275 | e.printStackTrace(); |
| 276 | } |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * 写文件 |
no test coverage detected