MCPcopy Create free account
hub / github.com/0opslab/opslabJutil / addWrite

Method addWrite

src/main/java/com/opslab/helper/FileHelper.java:308–320  ·  view source on GitHub ↗

写文件 @param file 需要处理的函数 @param str 添加的子字符串 @return 是否成功

(File file, String str)

Source from the content-addressed store, hash-verified

306 * @return 是否成功
307 */
308 public static boolean addWrite(File file, String str) {
309 try (
310 RandomAccessFile randomFile = new RandomAccessFile(file, "rw")
311 ) {
312 long fileLength = randomFile.length();
313 randomFile.seek(fileLength);
314 randomFile.writeBytes(str);
315 return true;
316 } catch (IOException e) {
317 e.printStackTrace();
318 }
319 return false;
320 }
321
322 /**
323 * 写文件

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected