Class FileUtils


  • public class FileUtils
    extends FileUtils
    Some basic file utilities.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FileUtils()
      Prevents initialization of this utility class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String fromIndependent​(java.io.File file)
      Converts a file into a string using a system independent separator.
      static java.lang.String fromIndependent​(java.lang.String file)
      Converts a file into a string using a system independent separator.
      static java.lang.String makeAbsolute​(java.io.File baseFolder, java.lang.String location)
      Makes a given location absolute if required.
      static java.io.File makeAbsoluteFile​(java.io.File baseFolder, java.lang.String location)
      Makes a given location absolute if required.
      static java.lang.String makeRelative​(java.io.File baseFolder, java.io.File location)
      Make a location relative to baseFolder if possible.
      static java.io.File makeRelativeFile​(java.io.File baseFolder, java.io.File location)
      Make a location relative to baseFolder if possible.
      static java.lang.String toIndependent​(java.lang.String file)
      Converts a string into a file using a system independent separator.
      static java.io.File toIndependentFile​(java.lang.String file)
      Converts a string into a file using a system independent separator.
      • Methods inherited from class java.lang.Object

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

      • SEPARATOR_STRING

        public static final java.lang.String SEPARATOR_STRING
    • Constructor Detail

      • FileUtils

        private FileUtils()
        Prevents initialization of this utility class.
    • Method Detail

      • makeAbsoluteFile

        public static final java.io.File makeAbsoluteFile​(java.io.File baseFolder,
                                                          java.lang.String location)
        Makes a given location absolute if required.
        Parameters:
        baseFolder - the base folder to be prepended if necessary
        location - the location to be made absolute
        Returns:
        the absolute location
      • makeAbsolute

        public static final java.lang.String makeAbsolute​(java.io.File baseFolder,
                                                          java.lang.String location)
        Makes a given location absolute if required.
        Parameters:
        baseFolder - the base folder to be prepended if necessary
        location - the location to be made absolute
        Returns:
        the absolute location as String
      • makeRelative

        public static final java.lang.String makeRelative​(java.io.File baseFolder,
                                                          java.io.File location)
        Make a location relative to baseFolder if possible.
        Parameters:
        baseFolder - the base folder
        location - the location to be made relative
        Returns:
        the relative location as String
      • makeRelativeFile

        public static final java.io.File makeRelativeFile​(java.io.File baseFolder,
                                                          java.io.File location)
        Make a location relative to baseFolder if possible.
        Parameters:
        baseFolder - the base folder
        location - the location to be made relative
        Returns:
        the relative location as String
      • fromIndependent

        public static final java.lang.String fromIndependent​(java.lang.String file)
        Converts a file into a string using a system independent separator.
        Parameters:
        file - the file to be converted
        Returns:
        the converted string
      • fromIndependent

        public static final java.lang.String fromIndependent​(java.io.File file)
        Converts a file into a string using a system independent separator.
        Parameters:
        file - the file to be converted
        Returns:
        the converted string
      • toIndependentFile

        public static final java.io.File toIndependentFile​(java.lang.String file)
        Converts a string into a file using a system independent separator.
        Parameters:
        file - the string to be converted
        Returns:
        the converted file
      • toIndependent

        public static final java.lang.String toIndependent​(java.lang.String file)
        Converts a string into a file using a system independent separator.
        Parameters:
        file - the string to be converted
        Returns:
        the converted file name