How do I flush a 'RandomAccessFile' (java)?

前端 未结 6 1656
孤街浪徒
孤街浪徒 2021-02-14 21:44

I\'m using RandomAccessFile in java:

file = new RandomAccessFile(filename, \"rw\");
...
file.writeBytes(...);

How can I ensure that this data i

6条回答
  •  无人共我
    2021-02-14 21:57

    The only classes that provide a .flush() method are those that actually maintain their own buffers. As java.io.RandomAccessFile does not itself maintain a buffer, it does not need to be flushed.

提交回复
热议问题