1 package org.simantics.scl.runtime.io;
4 import java.io.IOException;
5 import java.io.RandomAccessFile;
6 import java.nio.file.Files;
7 import java.nio.file.StandardCopyOption;
11 public static void moveFile(File source, File target) throws IOException {
12 Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
15 public static void copyFile(File source, File target) throws IOException {
16 Files.copy(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
19 public static void syncFile(File file) throws IOException {
20 try (RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
25 public static File createTempDirectory(String prefix, File parent) throws IOException {
27 return Files.createTempDirectory(parent.toPath(), prefix).toFile();
29 return Files.createTempDirectory(prefix).toFile();