Package io.quarkus.analytics.util
Class FileUtils
- java.lang.Object
-
- io.quarkus.analytics.util.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 voidappend(String content, Path path)Writes a String to filestatic voidcreateFileAndParent(Path path)Creates the file for the given path and the folder that contains it.static <T> voidoverwrite(T content, Path path)Writes an object, as JSON to file.static <T> Optional<T>read(Class<T> clazz, Path path, MessageWriter log)static <T> voidwrite(T content, Path path)Writes an object, as JSON to file
-
-
-
Method Detail
-
createFileAndParent
public static void createFileAndParent(Path path) throws IOException
Creates the file for the given path and the folder that contains it. Does nothing if it any of those already exist.- Parameters:
path- the file to create- Throws:
IOException- if the file operation fails
-
append
public static void append(String content, Path path) throws IOException
Writes a String to file- Parameters:
content-path-- Throws:
IOException
-
write
public static <T> void write(T content, Path path) throws IOExceptionWrites an object, as JSON to file- Type Parameters:
T-- Parameters:
content-path-- Throws:
IOException
-
overwrite
public static <T> void overwrite(T content, Path path) throws IOExceptionWrites an object, as JSON to file. Deletes previous file if it exists, before writing the new one.- Type Parameters:
T-- Parameters:
content-path-- Throws:
IOException
-
read
public static <T> Optional<T> read(Class<T> clazz, Path path, MessageWriter log) throws IOException
- Throws:
IOException
-
-