Watch
2
0
Fork
You've already forked streamtime
0
Input/output stream progress.
  • Java 90.8%
  • Shell 8.9%
  • CSS 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mark Raynsford f942ebdd31
Some checks are pending
main-RHEL9-x86_64-jdk26 / Build (push) Waiting to run
main-RHEL10-x86_64-jdk25 / Build (push) Waiting to run
main-RHEL10-x86_64-jdk26 / Build (push) Waiting to run
main-RHEL9-x86_64-jdk25 / Build (push) Waiting to run
Update workflows.
2026-07-31 18:42:59 +01:00
.forgejo Update workflows. 2026-07-31 18:42:59 +01:00
com.io7m.streamtime.core Begin next development iteration. 2024-05-11 14:17:56 +00:00
com.io7m.streamtime.tests Use junit BOM. 2024-10-26 13:01:46 +00:00
src/site/resources Update site metadata. 2025-08-09 15:07:16 +00:00
.gitignore Update .gitignore. 2024-05-07 16:01:47 +00:00
doc7m-books.json Add doc7m-books.json 2026-07-31 18:36:50 +01:00
pom.xml Migrate project. 2026-06-27 10:13:38 +01:00
README-CHANGES.xml Mark release 1.0.0 2024-05-11 14:17:48 +00:00
README-LICENSE.txt Update LICENSE 2023-08-13 21:07:30 +00:00
README.in Migrate project. 2026-06-27 10:13:38 +01:00
README.md Migrate project. 2026-06-27 10:13:38 +01:00

streamtime

Maven Central Maven Central (snapshot) Java Version

com.io7m.streamtime

streamtime

The streamtime package provides a simple extension to Java I/O streams that can track transfer rates and provide statistics.

Features

  • Input and output stream implementations that track and regularly broadcast transfer statistics.
  • High coverage test suite.
  • OSGi-ready.
  • JPMS-ready.
  • ISC license.

Usage

Create a STTimedInputStream from an existing InputStream, and provide it with a Consumer<STTransferStatistics> function that receives transfer updates:

InputStream is;
Consumer<STTransferStatistics> f;

try (var input = new STTimedInputStream(f, is)) {
  input.transferTo(...);
}

The f function will be called at a rate of roughly once per second, with a new value of type STTransferStatistics describing the expected number of octets, the current number of octets, and the current number of octets received per second.

The STTimedOutputStream class works similarly, but for OutputStream values.