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

Method write

src/main/java/com/opslab/util/FileUtil.java:222–232  ·  view source on GitHub ↗

将字符串写入到文件中

(File file, String str)

Source from the content-addressed store, hash-verified

220 * 将字符串写入到文件中
221 */
222 public final static boolean write(File file, String str) {
223 try (
224 RandomAccessFile randomFile = new RandomAccessFile(file, "rw")
225 ) {
226 randomFile.writeBytes(str);
227 return true;
228 } catch (IOException e) {
229 e.printStackTrace();
230 }
231 return false;
232 }
233
234 /**
235 * 将字符串以追加的方式写入到文件中

Callers 15

testWriteFileMethod · 0.95
testWriteFileMethod · 0.95
testImageMethod · 0.45
toByteArrayMethod · 0.45
stream2ByteMethod · 0.45
streamSaveAsFileMethod · 0.45
appendLineMethod · 0.45
writeAppendMethod · 0.45
cleanFileMethod · 0.45
copyMethod · 0.45
zipFileMethod · 0.45
unCompressMethod · 0.45

Calls

no outgoing calls

Tested by 4

testWriteFileMethod · 0.76
testWriteFileMethod · 0.76
testImageMethod · 0.36
toByteArrayMethod · 0.36