Class FileUtil


  • public class FileUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File[] breakPaths​(java.lang.String paths)  
      static java.io.File getRelativeFile​(java.io.File workingDirectory, java.io.File targetFile)
      Returns a relative path for the targetFile relative to the base directory.
      static java.lang.String truncatePath​(java.lang.String path, java.lang.String baseDirectory)  
      • Methods inherited from class java.lang.Object

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

      • FileUtil

        public FileUtil()
    • Method Detail

      • getRelativeFile

        public static java.io.File getRelativeFile​(java.io.File workingDirectory,
                                                   java.io.File targetFile)
        Returns a relative path for the targetFile relative to the base directory.
        Parameters:
        canonicalBase - base directory as returned by File.getCanonicalPath()
        targetFile - target file
        Returns:
        relative path of target file. Returns targetFile if there were no commonalities between the base and the target
      • breakPaths

        public static java.io.File[] breakPaths​(java.lang.String paths)
      • truncatePath

        public static java.lang.String truncatePath​(java.lang.String path,
                                                    java.lang.String baseDirectory)
        Parameters:
        path - String
        baseDirectory - String
        Returns:
        relative path to a base directory if possible