Class PatternProcessor


  • public class PatternProcessor
    extends java.lang.Object
    Parses the rollover pattern.
    • Field Detail

      • LOGGER

        protected static final Logger LOGGER
      • WEEK_CHARS

        private static final char[] WEEK_CHARS
      • DAY_CHARS

        private static final char[] DAY_CHARS
      • HOUR_CHARS

        private static final char[] HOUR_CHARS
      • prevFileTime

        private long prevFileTime
      • nextFileTime

        private long nextFileTime
      • currentFileTime

        private long currentFileTime
      • isTimeBased

        private boolean isTimeBased
      • timeZone

        private java.util.TimeZone timeZone
      • pattern

        private final java.lang.String pattern
    • Constructor Detail

      • PatternProcessor

        public PatternProcessor​(java.lang.String pattern)
        Constructor.
        Parameters:
        pattern - The file pattern.
      • PatternProcessor

        public PatternProcessor​(java.lang.String pattern,
                                PatternProcessor copy)
        Copy constructor with another pattern as source.
        Parameters:
        pattern - The file pattern.
        copy - Source pattern processor
    • Method Detail

      • getPattern

        public java.lang.String getPattern()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setTimeBased

        public void setTimeBased​(boolean isTimeBased)
      • getCurrentFileTime

        public long getCurrentFileTime()
      • setCurrentFileTime

        public void setCurrentFileTime​(long currentFileTime)
      • getPrevFileTime

        public long getPrevFileTime()
      • setPrevFileTime

        public void setPrevFileTime​(long prevFileTime)
      • getNextTime

        public long getNextTime​(long currentMillis,
                                int increment,
                                boolean modulus)
        Returns the next potential rollover time.
        Parameters:
        currentMillis - The current time.
        increment - The increment to the next time.
        modulus - If true the time will be rounded to occur on a boundary aligned with the increment.
        Returns:
        the next potential rollover time and the timestamp for the target file.
      • updateTime

        public void updateTime()
      • debugGetNextTime

        private long debugGetNextTime​(long nextTime)
      • format

        private java.lang.String format​(long time)
      • increment

        private void increment​(java.util.Calendar cal,
                               int type,
                               int increment,
                               boolean modulate)
      • formatFileName

        public final void formatFileName​(java.lang.StringBuilder buf,
                                         boolean useCurrentTime,
                                         java.lang.Object obj)
        Format file name.
        Parameters:
        buf - string buffer to which formatted file name is appended, may not be null.
        obj - object to be evaluated in formatting, may not be null.
      • formatFileName

        public final void formatFileName​(StrSubstitutor subst,
                                         java.lang.StringBuilder buf,
                                         java.lang.Object obj)
        Formats file name.
        Parameters:
        subst - The StrSubstitutor.
        buf - string buffer to which formatted file name is appended, may not be null.
        obj - object to be evaluated in formatting, may not be null.
      • formatFileName

        public final void formatFileName​(StrSubstitutor subst,
                                         java.lang.StringBuilder buf,
                                         boolean useCurrentTime,
                                         java.lang.Object obj)
        Formats file name.
        Parameters:
        subst - The StrSubstitutor.
        buf - string buffer to which formatted file name is appended, may not be null.
        obj - object to be evaluated in formatting, may not be null.
      • formatFileName

        protected final void formatFileName​(java.lang.StringBuilder buf,
                                            java.lang.Object... objects)
        Formats file name.
        Parameters:
        buf - string buffer to which formatted file name is appended, may not be null.
        objects - objects to be evaluated in formatting, may not be null.
      • calculateFrequency

        private RolloverFrequency calculateFrequency​(java.lang.String pattern)
      • createPatternParser

        private PatternParser createPatternParser()
      • patternContains

        private boolean patternContains​(java.lang.String pattern,
                                        char... chars)
      • patternContains

        private boolean patternContains​(java.lang.String pattern,
                                        char character)
      • getNextFileTime

        public long getNextFileTime()