Class NewerThan

  • All Implemented Interfaces:
    java.io.FileFilter

    public class NewerThan
    extends LastModifiedFilter
    FileFilter accepts files based on the last modified time of the file.

    As the name suggests, files are accepted based on whether or not the last modified time is newer than the specified interval. The interval either follows the ISO8601 convention for durations or is the precise number of milliseconds since the epoch.

    The interval is represented by the format [+-]P[n]Y[n]M[n]DT[n]H[n]M[n]S. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required. The capital letters 'P', 'Y', 'M', 'W', 'D', 'T', 'H', 'M', and 'S' are designators for each of the date and time elements and are not replaced.

    • P is the duration designator (historically called "period") placed at the start of the duration representation.
    • Y is the year designator that follows the value for the number of years.
    • M is the month designator that follows the value for the number of months.
    • W is the week designator that follows the value for the number of weeks.
    • D is the day designator that follows the value for the number of days.
    • T is the time designator that precedes the time components of the representation.
    • H is the hour designator that follows the value for the number of hours.
    • M is the minute designator that follows the value for the number of minutes.
    • S is the second designator that follows the value for the number of seconds.

      For example, P3Y6M4DT12H30M5S represents a duration of three years, six months, four days, twelve hours, thirty minutes, and five seconds . Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations.

      To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The seconds value used may also have a decimal fraction, as in "PT0.5S" to indicate half a second."PT36H" could be used as well as "P1DT12H" for representing the same duration.

      A negative period will become some date in the past; a positive or unspecified period will resolve to some time in the future. For example -P30D will resolve to 30 days ago, whereas P30D will resolve to 30 days in the future.

    See Also:
    Duration
    • Constructor Summary

      Constructors 
      Constructor Description
      NewerThan​(java.lang.String s)
      Create the filefilter using an ISO8601 formatted interval.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File pathname)  
      • Methods inherited from class java.lang.Object

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

      • NewerThan

        public NewerThan​(java.lang.String s)
        Create the filefilter using an ISO8601 formatted interval.
        Parameters:
        s - the iso8601 interval or the absolute time (MS since epoch)
    • Method Detail

      • accept

        public boolean accept​(java.io.File pathname)