Class GFileUtils


  • @Deprecated
    public class GFileUtils
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      GFileUtils()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.util.zip.Checksum checksum​(java.io.File file, java.util.zip.Checksum checksum)
      Deprecated.
       
      static void copyDirectory​(java.io.File source, java.io.File destination)
      Deprecated.
       
      static void copyFile​(java.io.File source, java.io.File destination)
      Deprecated.
      If the destination file exists, then this method will overwrite it.
      static void copyURLToFile​(java.net.URL source, java.io.File destination)
      Deprecated.
       
      static void deleteDirectory​(java.io.File directory)
      Deprecated.
       
      static boolean deleteQuietly​(java.io.File file)
      Deprecated.
       
      static void forceDelete​(java.io.File file)
      Deprecated.
       
      static java.util.Collection<java.io.File> listFiles​(java.io.File directory, java.lang.String[] extensions, boolean recursive)
      Deprecated.
       
      static void mkdirs​(java.io.File dir)
      Deprecated.
      Like File.mkdirs(), except throws an informative error if a dir cannot be created.
      static void moveDirectory​(java.io.File source, java.io.File destination)
      Deprecated.
       
      static void moveExistingDirectory​(java.io.File source, java.io.File destination)
      Deprecated.
       
      static void moveExistingFile​(java.io.File source, java.io.File destination)
      Deprecated.
       
      static void moveFile​(java.io.File source, java.io.File destination)
      Deprecated.
       
      static java.io.FileInputStream openInputStream​(java.io.File file)
      Deprecated.
       
      static java.io.File parentMkdirs​(java.io.File child)
      Deprecated.
      Makes the parent directory of the file, and any non existent parents.
      static java.lang.String readFile​(java.io.File file)
      Deprecated.
       
      static java.lang.String readFile​(java.io.File file, java.lang.String encoding)
      Deprecated.
       
      static java.lang.String readFileQuietly​(java.io.File file)
      Deprecated.
      Reads and returns file contents.
      static java.lang.String relativePathOf​(java.io.File target, java.io.File base)
      Deprecated.
      Returns the path of target relative to base.
      static java.lang.String tail​(java.io.File file, int maxLines)
      Deprecated.
      Returns the tail of a file.
      static java.util.List<java.lang.String> toPaths​(java.util.Collection<java.io.File> files)
      Deprecated.
       
      static void touch​(java.io.File file)
      Deprecated.
      Ensures that the given file (or directory) is marked as modified.
      static void touchExisting​(java.io.File file)
      Deprecated.
      Ensures that the given file (or directory) is marked as modified.
      static void writeFile​(java.lang.String content, java.io.File destination)
      Deprecated.
       
      static void writeFile​(java.lang.String content, java.io.File destination, java.lang.String encoding)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

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

      • GFileUtils

        public GFileUtils()
        Deprecated.
    • Method Detail

      • openInputStream

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

        public static void touch​(java.io.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​(java.io.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​(java.io.File source,
                                    java.io.File destination)
        Deprecated.
      • moveExistingFile

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

        public static void copyFile​(java.io.File source,
                                    java.io.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​(java.io.File source,
                                         java.io.File destination)
        Deprecated.
      • moveDirectory

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

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

        public static java.lang.String readFile​(java.io.File file)
        Deprecated.
      • readFile

        public static java.lang.String readFile​(java.io.File file,
                                                java.lang.String encoding)
        Deprecated.
      • readFileQuietly

        public static java.lang.String readFileQuietly​(java.io.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​(java.lang.String content,
                                     java.io.File destination)
        Deprecated.
      • writeFile

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

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

        public static java.util.List<java.lang.String> toPaths​(java.util.Collection<java.io.File> files)
        Deprecated.
      • copyURLToFile

        public static void copyURLToFile​(java.net.URL source,
                                         java.io.File destination)
        Deprecated.
      • deleteDirectory

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

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

        public static java.lang.String tail​(java.io.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​(java.io.File file)
        Deprecated.
      • checksum

        public static java.util.zip.Checksum checksum​(java.io.File file,
                                                      java.util.zip.Checksum checksum)
        Deprecated.
      • parentMkdirs

        public static java.io.File parentMkdirs​(java.io.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(java.io.File)
      • mkdirs

        public static void mkdirs​(java.io.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 java.lang.String relativePathOf​(java.io.File target,
                                                      java.io.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.