Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

io7m-com/streamtime

Repository files navigation

streamtime

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.streamtime

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

Repository Relocation

Development of this project has moved to an open-source but not open-contribution model.

Source code and commits will remain publicly available perpetually, but issues and/or pull requests will be rejected and/or ignored. Additionally, this project will now only be available via a read-only mirror at:

https://codeberg.org/io7m-com/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.

About

Input/output stream progress.

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Contributors