将字符串写入到文件中
(File file, String str)
| 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 | * 将字符串以追加的方式写入到文件中 |
no outgoing calls