Class GCLogFileSegment

  • All Implemented Interfaces:
    LogFileSegment

    public class GCLogFileSegment
    extends Object
    implements LogFileSegment
    A RotatingGCLogFile is made up of GarbageCollectionLogFileSegments. Creating a GarbageCollectionLogFileSegment is not necessary when the RotatingGCLogFile(Path) constructor is used. The { @ link RotatingGCLogFile # RotatingGCLogFile(Path, List) } constructor allows the user to provide a list of discrete GarbageCollectionLogFileSegements for a RotatingGCLogFile.
    • Constructor Detail

      • GCLogFileSegment

        public GCLogFileSegment​(Path path)
        The constructor attempts to extract the segment index from the file name.
        Parameters:
        path - The path to the file.
    • Method Detail

      • getPath

        public Path getPath()
        Return the path to the file.
        Specified by:
        getPath in interface LogFileSegment
        Returns:
        The path to the file.
      • getStartTime

        public double getStartTime()
        return some comparable value for the first time found in the log. If isn't found, then return min value. This combined with the end time being a max value implies the log covers an impossible amount of time. The sorting logic in the Metadata classes should filter out these types of segments.
        Specified by:
        getStartTime in interface LogFileSegment
        Returns:
        double representing either the age of the JVM or time from epoch if only a date stamp is found at the beginning of the log file
      • getEndTime

        public double getEndTime()
        return some comparable value for the last time found in the log. If isn't found, then return max value. This combined with the start time implies the log covers an impossible amount of time. The sorting logic in the Metadata classes should filter out these types of segments.
        Specified by:
        getEndTime in interface LogFileSegment
        Returns:
        double representing either the age of the JVM or time from epoch if only a date stamp is found at the end of the log file
      • getSegmentIndex

        public int getSegmentIndex()
        The segment index is the integer appended to the file name. If the file name does not have a segment index, then Integer.MAX_VALUE is returned.
        Returns:
        The segment index, or Integer.MAX_VALUE if the file does not have a segment index.
      • stream

        public Stream<String> stream()
        Stream the file, one line at a time.
        Specified by:
        stream in interface LogFileSegment
        Returns:
        A stream of lines from the file.
      • isCurrent

        public boolean isCurrent()
        Return true if the log file segment was the file being written to.
        Returns:
        true if the log file segment was the current file.
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        Returns this.getName();