Class TimestampedObserver


  • public class TimestampedObserver
    extends ObservableInputStream.Observer
    An observer with timestamps.

    For example:

     final TimestampedObserver timetampedObserver = new TimestampedObserver();
     try (final ObservableInputStream inputStream = new ObservableInputStream(...),
         timetampedObserver)) {
         ...
     }
     System.out.printf("IO duration: %s%n", timetampedObserver.getOpenToCloseDuration());
     
    Since:
    2.9.0
    • Constructor Detail

      • TimestampedObserver

        public TimestampedObserver()
    • Method Detail

      • getCloseInstant

        public java.time.Instant getCloseInstant()
        Gets the instant for when this instance was closed.
        Returns:
        the instant for when closed was called.
      • getOpenToCloseDuration

        public java.time.Duration getOpenToCloseDuration()
        Gets the Duration between creation and close.
        Returns:
        the Duration between creation and close.
      • getOpenToNowDuration

        public java.time.Duration getOpenToNowDuration()
        Gets the Duration between creation and now.
        Returns:
        the Duration between creation and now.
      • getOpenInstant

        public java.time.Instant getOpenInstant()
        Gets the instant for when this instance was created.
        Returns:
        the instant for when this instance was created.
      • toString

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