Class FileUtils

java.lang.Object
io.sentry.util.FileUtils

@Internal public final class FileUtils extends Object
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • deleteRecursively

      public static boolean deleteRecursively(@Nullable @Nullable 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 String readText(@Nullable @Nullable File file) throws 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:
      IOException - In case of error reading the file