Class TimeUtil


  • public class TimeUtil
    extends java.lang.Object
    Utility methods for handling timestamps
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void setLastModifiedOf​(java.nio.file.Path a, java.nio.file.Path b)
      Set the lastModified time of file a to the one from file b
      static java.time.Instant setLastModifiedWithOffset​(java.nio.file.Path path, long offsetMillis)
      Set the lastModified time of a given file by adding a given offset to the current lastModified time
      • Methods inherited from class java.lang.Object

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

      • TimeUtil

        public TimeUtil()
    • Method Detail

      • setLastModifiedWithOffset

        public static java.time.Instant setLastModifiedWithOffset​(java.nio.file.Path path,
                                                                  long offsetMillis)
        Set the lastModified time of a given file by adding a given offset to the current lastModified time
        Parameters:
        path - path of a file to set last modified
        offsetMillis - offset in milliseconds, if negative the new lastModified time is offset before the original lastModified time, otherwise after the original time
        Returns:
        the new lastModified time
      • setLastModifiedOf

        public static void setLastModifiedOf​(java.nio.file.Path a,
                                             java.nio.file.Path b)
        Set the lastModified time of file a to the one from file b
        Parameters:
        a - file to set lastModified time
        b - file to read lastModified time from