Class GFileUtils

java.lang.Object
org.gradle.util.GFileUtils

@Deprecated public class GFileUtils extends Object
Deprecated.
Will be removed in Gradle 9.0.
This class is only here to maintain binary compatibility with existing plugins.

Plugins should prefer java.io, java.nio or external packages over this class.

  • Constructor Details

    • GFileUtils

      public GFileUtils()
      Deprecated.
  • Method Details

    • openInputStream

      public static FileInputStream openInputStream(File file)
      Deprecated.
    • touch

      public static void touch(File file)
      Deprecated.
      Ensures that the given file (or directory) is marked as modified. If the file (or directory) does not exist, a new file is created.
    • touchExisting

      public static void touchExisting(File file)
      Deprecated.
      Ensures that the given file (or directory) is marked as modified. The file (or directory) must exist.
    • moveFile

      public static void moveFile(File source, File destination)
      Deprecated.
    • moveExistingFile

      public static void moveExistingFile(File source, File destination)
      Deprecated.
    • copyFile

      public static void copyFile(File source, File destination)
      Deprecated.
      If the destination file exists, then this method will overwrite it.
      See Also:
      • FileUtils.copyFile(File, File)
    • copyDirectory

      public static void copyDirectory(File source, File destination)
      Deprecated.
    • moveDirectory

      public static void moveDirectory(File source, File destination)
      Deprecated.
    • moveExistingDirectory

      public static void moveExistingDirectory(File source, File destination)
      Deprecated.
    • readFile

      public static String readFile(File file)
      Deprecated.
    • readFile

      public static String readFile(File file, String encoding)
      Deprecated.
    • readFileQuietly

      public static String readFileQuietly(File file)
      Deprecated.
      Reads and returns file contents. If some exception is triggered the method returns information about this exception. Useful for including file contents in debug trace / exception messages.
      Parameters:
      file - to read
      Returns:
      content of the file or the problem description in case file cannot be read.
    • writeFile

      public static void writeFile(String content, File destination)
      Deprecated.
    • writeFile

      public static void writeFile(String content, File destination, String encoding)
      Deprecated.
    • listFiles

      public static Collection<File> listFiles(File directory, String[] extensions, boolean recursive)
      Deprecated.
    • toPaths

      public static List<String> toPaths(Collection<File> files)
      Deprecated.
    • copyURLToFile

      public static void copyURLToFile(URL source, File destination)
      Deprecated.
    • deleteDirectory

      public static void deleteDirectory(File directory)
      Deprecated.
    • deleteQuietly

      public static boolean deleteQuietly(@Nullable File file)
      Deprecated.
    • tail

      public static String tail(File file, int maxLines) throws GFileUtils.TailReadingException
      Deprecated.
      Returns the tail of a file.
      Parameters:
      file - to read from tail
      maxLines - max lines to read
      Returns:
      tail content
      Throws:
      GFileUtils.TailReadingException - when reading failed
    • forceDelete

      public static void forceDelete(File file)
      Deprecated.
    • checksum

      public static Checksum checksum(File file, Checksum checksum)
      Deprecated.
    • parentMkdirs

      public static File parentMkdirs(File child)
      Deprecated.
      Makes the parent directory of the file, and any non existent parents.
      Parameters:
      child - The file to create the parent dir for
      Returns:
      The parent dir file
      See Also:
    • mkdirs

      public static void mkdirs(File dir)
      Deprecated.
      Like File.mkdirs(), except throws an informative error if a dir cannot be created.
      Parameters:
      dir - The dir to create, including any non existent parent dirs.
    • relativePathOf

      public static String relativePathOf(File target, File base)
      Deprecated.
      Returns the path of target relative to base.
      Parameters:
      target - target file or directory
      base - base directory
      Returns:
      the path of target relative to base.