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 timetampedObserver = new TimestampedObserver();
try (final ObservableInputStream inputStream = new ObservableInputStream(...),
timetampedObserver)) {
...
}
System.out.printf("IO duration: %s%n", timetampedObserver.getOpenToCloseDuration());
- Since:
- 2.9.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier 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.toString()Methods inherited from class org.apache.commons.io.input.ObservableInputStream.Observer
data, data, error, finished
-
Field Details
-
closeInstant
-
openInstant
-
-
Constructor Details
-
TimestampedObserver
public TimestampedObserver()
-
-
Method Details
-
closed
Description copied from class:ObservableInputStream.ObserverCalled to indicate that theObservableInputStreamhas been closed.- Overrides:
closedin classObservableInputStream.Observer- Throws:
IOException- if an I/O error occurs.
-
getCloseInstant
Gets the instant for when this instance was closed.- Returns:
- the instant for when closed was called.
-
getOpenToCloseDuration
Gets the Duration between creation and close.- Returns:
- the Duration between creation and close.
-
getOpenToNowDuration
Gets the Duration between creation and now.- Returns:
- the Duration between creation and now.
-
getOpenInstant
Gets the instant for when this instance was created.- Returns:
- the instant for when this instance was created.
-
toString
-