+
+ public static void syncFile(File file) throws IOException {
+ try (RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
+ raf.getFD().sync();
+ }
+ }
+
+ public static void sync(Path path) throws IOException {
+ try (InputStream stream = Files.newInputStream(path, StandardOpenOption.SYNC)) {
+ }
+ }