Class FileUtils

java.lang.Object
io.quarkus.analytics.util.FileUtils

public class FileUtils extends Object
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • 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 IOException
      Writes 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 IOException
      Writes 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, io.quarkus.devtools.messagewriter.MessageWriter log) throws IOException
      Throws:
      IOException