Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Java, the <code>flush()</code> method is used in output streams and writers to ensure that buffered data is written out. However, according to the Javadocs:</p> <blockquote> <p>If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive. </p> </blockquote> <p>On the other hand, <code>FileDescriptor.sync()</code> can be used to ensure that data buffered by the OS is written to the physical device (disk). This is the same as the <code>sync</code> call in Linux / POSIX.</p> <p>If your Java application really needs to ensure that data is physically written to disk, you may need to <code>flush</code> and <code>sync</code>, e.g.:</p> <pre><code>FileOutputStream out = new FileOutputStream(filename); [...] out.flush(); out.getFD().sync(); </code></pre> <p>References:</p> <ul> <li><a href="http://download.oracle.com/javase/6/docs/api/java/io/OutputStream.html#flush%28%29" rel="noreferrer">http://download.oracle.com/javase/6/docs/api/java/io/OutputStream.html#flush%28%29</a></li> <li><a href="http://download.oracle.com/javase/6/docs/api/java/io/Writer.html#flush%28%29" rel="noreferrer">http://download.oracle.com/javase/6/docs/api/java/io/Writer.html#flush%28%29</a></li> <li><a href="http://download.oracle.com/javase/6/docs/api/java/io/FileDescriptor.html#sync%28%29" rel="noreferrer">http://download.oracle.com/javase/6/docs/api/java/io/FileDescriptor.html#sync%28%29</a></li> <li><a href="http://linux.die.net/man/2/sync" rel="noreferrer">http://linux.die.net/man/2/sync</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload