Class PathUtils


  • public class PathUtils
    extends java.lang.Object
    Some path utilities.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PathUtils()
      Prevents external creation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static boolean isPattern​(java.io.File file)
      Returns whether (the path to) file is a pattern (ANT).
      (package private) static boolean isPattern​(java.lang.String path)
      Returns whether the given path is a pattern (ANT).
      static java.lang.String normalize​(java.io.File file)
      Normalizes the path of the given file to a VIL path string (slash-separated).
      static java.lang.String normalize​(java.lang.String file)
      Normalizes the path of the given file to a VIL path string (slash-separated).
      static long normalizedTime()
      Normalizes the current system time by calling normalizeTime(long).
      static long normalizeTime​(long time)
      Normalizes the given time in order to make it portable across known operating systems.
      static long normalizeTime​(java.io.File file)
      Normalizes the last modification time of file.
      • Methods inherited from class java.lang.Object

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

      • PathUtils

        private PathUtils()
        Prevents external creation.
    • Method Detail

      • normalize

        public static final java.lang.String normalize​(java.io.File file)
        Normalizes the path of the given file to a VIL path string (slash-separated).
        Parameters:
        file - the file to be normalized
        Returns:
        the normalized string
      • normalize

        public static final java.lang.String normalize​(java.lang.String file)
        Normalizes the path of the given file to a VIL path string (slash-separated).
        Parameters:
        file - the file to be normalized
        Returns:
        the normalized string
      • normalizeTime

        public static final long normalizeTime​(long time)
        Normalizes the given time in order to make it portable across known operating systems. However, the "approximate" precision of Windows file systems is closer to the real time than Linux file systems (1s precision). Thus, this method normalizes the time by setting the milliseconds to zero. Please note that comparisons for more recent file / timestamps shall include equality to the reduced precision of caused by this method.
        Parameters:
        time - the time stamp to be normalized
        Returns:
        the normalized time
      • normalizeTime

        public static final long normalizeTime​(java.io.File file)
        Normalizes the last modification time of file. This method calls normalizeTime(long).
        Parameters:
        file - the file to return the normalized time for
        Returns:
        the normalized time
      • normalizedTime

        public static final long normalizedTime()
        Normalizes the current system time by calling normalizeTime(long).
        Returns:
        the normalized system time
      • isPattern

        static boolean isPattern​(java.io.File file)
        Returns whether (the path to) file is a pattern (ANT).
        Parameters:
        file - the file to the path shall be analyzed
        Returns:
        true if file is a pattern, false if the path to file is a true path
      • isPattern

        static boolean isPattern​(java.lang.String path)
        Returns whether the given path is a pattern (ANT).
        Parameters:
        path - the path to be analyzed
        Returns:
        true if path is a pattern, false if path is a true path