Class SyncableFileOutputStream

java.lang.Object
java.io.OutputStream
java.io.FileOutputStream
org.apache.avro.file.SyncableFileOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Syncable

public class SyncableFileOutputStream extends FileOutputStream implements Syncable
An implementation of Syncable which writes to a file. An instance of this class can be used with DataFileWriter to guarantee that Avro Container Files are persisted to disk on supported platforms using the DataFileWriter.fSync() method.
See Also:
  • Constructor Details

  • Method Details

    • sync

      public void sync() throws IOException
      Sync the file to disk. On supported platforms, this method behaves like POSIX fsync and syncs all underlying OS buffers for this file descriptor to disk. On these platforms, if this method returns, the data written to this instance is guaranteed to be persisted on disk.
      Specified by:
      sync in interface Syncable
      Throws:
      IOException - - if an error occurred while attempting to sync the data to disk.