Class FileUtils


  • @Internal
    public final class FileUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean deleteRecursively​(@Nullable java.io.File file)
      Deletes the file or directory denoted by a path.
      static @Nullable java.lang.String readText​(@Nullable java.io.File file)
      Reads the content of a File into a String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • Method Detail

      • deleteRecursively

        public static boolean deleteRecursively​(@Nullable
                                                @Nullable java.io.File file)
        Deletes the file or directory denoted by a path. If it is a directory, all files and directory inside it are deleted recursively. Note that if this operation fails then partial deletion may have taken place.
        Parameters:
        file - file or directory to delete
        Returns:
        true if the file/directory is successfully deleted, false otherwise
      • readText

        @Nullable
        public static @Nullable java.lang.String readText​(@Nullable
                                                          @Nullable java.io.File file)
                                                   throws java.io.IOException
        Reads the content of a File into a String. If the file does not exist or is not a file, null is returned. Do not use with large files, as the String is kept in memory!
        Parameters:
        file - file to read
        Returns:
        a String containing all the content of the file, or null if it doesn't exists
        Throws:
        java.io.IOException - In case of error reading the file