Class FileUtils


  • public class FileUtils
    extends Object
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • 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 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