Class FileUtils


  • public abstract class FileUtils
    extends java.lang.Object
    Utilities for manipulating files and directories in Spring Boot tooling.
    Author:
    Dave Syer, Phillip Webb
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtils()  
    • Method Summary

      Modifier and Type Method Description
      static void removeDuplicatesFromOutputDirectory​(java.io.File outputDirectory, java.io.File originDirectory)
      Utility to remove duplicate files from an "output" directory if they already exist in an "origin".
      static java.lang.String sha1Hash​(java.io.File file)
      Generate a SHA.1 Hash for a given file.
      • 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

      • removeDuplicatesFromOutputDirectory

        public static void removeDuplicatesFromOutputDirectory​(java.io.File outputDirectory,
                                                               java.io.File originDirectory)
        Utility to remove duplicate files from an "output" directory if they already exist in an "origin". Recursively scans the origin directory looking for files (not directories) that exist in both places and deleting the copy.
        Parameters:
        outputDirectory - the output directory
        originDirectory - the origin directory
      • sha1Hash

        public static java.lang.String sha1Hash​(java.io.File file)
                                         throws java.io.IOException
        Generate a SHA.1 Hash for a given file.
        Parameters:
        file - the file to hash
        Returns:
        the hash value as a String
        Throws:
        java.io.IOException - if the file cannot be read