Package org.apache.commons.io.input
Class TimestampedObserver
java.lang.Object
org.apache.commons.io.input.ObservableInputStream.Observer
org.apache.commons.io.input.TimestampedObserver
An observer with timestamps.
 
For example:
 final TimestampedObserver timestampedObserver = new TimestampedObserver();
 try (ObservableInputStream inputStream = new ObservableInputStream(...),
     timestampedObserver)) {
     ...
 }
 System.out.printf("IO duration: %s%n", timestampedObserver.getOpenToCloseDuration());
 - Since:
- 2.9.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclosed()Called to indicate that theObservableInputStreamhas been closed.Gets the instant for when this instance was closed.Gets the instant for when this instance was created.Gets the Duration between creation and close.Gets the Duration between creation and now.booleanisClosed()Tests whetherclosed()has been called.toString()Methods inherited from class org.apache.commons.io.input.ObservableInputStream.Observerdata, data, error, finished
- 
Constructor Details- 
TimestampedObserverpublic TimestampedObserver()Constructs a new instance.
 
- 
- 
Method Details- 
closedDescription copied from class:ObservableInputStream.ObserverCalled to indicate that theObservableInputStreamhas been closed.- Overrides:
- closedin class- ObservableInputStream.Observer
- Throws:
- IOException- if an I/O error occurs.
 
- 
getCloseInstantGets the instant for when this instance was closed.- Returns:
- the instant for when closed was called.
 
- 
getOpenInstantGets the instant for when this instance was created.- Returns:
- the instant for when this instance was created.
 
- 
getOpenToCloseDurationGets the Duration between creation and close.- Returns:
- the Duration between creation and close.
 
- 
getOpenToNowDurationGets the Duration between creation and now.- Returns:
- the Duration between creation and now.
 
- 
isClosedTests whetherclosed()has been called.- Returns:
- whether closed()has been called.
- Since:
- 2.12.0
 
- 
toString
 
-