Package org.yamcs.utils
Class FileUtils
- java.lang.Object
-
- org.yamcs.utils.FileUtils
-
public class FileUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddeleteContents(Path directory)static voiddeleteRecursively(Path dirToRemove)static voiddeleteRecursivelyIfExists(Path path)static voidwriteAtomic(Path file, byte[] bytes)Writes bytes to a file in two phases via a temporary file in the same folder.
-
-
-
Method Detail
-
deleteRecursively
public static void deleteRecursively(Path dirToRemove) throws IOException
- Throws:
IOException
-
deleteRecursivelyIfExists
public static void deleteRecursivelyIfExists(Path path) throws IOException
- Throws:
IOException
-
deleteContents
public static void deleteContents(Path directory) throws IOException
- Throws:
IOException
-
writeAtomic
public static void writeAtomic(Path file, byte[] bytes) throws IOException
Writes bytes to a file in two phases via a temporary file in the same folder. This will either succeed or fail and leave the original file in place.- Throws:
IOException
-
-