Events/Java/minified-java

ExtractArchiveEvent

Gets fired while a downloaded Java archive is being extracted

Fields

archiveTypeArchiveType

The archive format currently being extracted

Accessor: archiveType()
progressint

The extraction progress in percent, from 0 to 100

Accessor: progress()

Types

ArchiveType

API
zipThe archive is a ZIP file
tarGzThe archive is a gzipped tarball

When it fires

This fires immediately after JavaArchiveDownloadEvent finishes and the archive's checksum has been verified. Which archive format is used - zip or tarGz - depends on the Adoptium asset for the current platform (Windows typically ships .zip, Linux/macOS typically ship .tar.gz).

Both formats always post a progress: 0 event right at the start. After that:

  • zip extraction reports whole-percent progress (0-100) throttled to roughly every 100ms, based on the number of ZIP entries processed - the last entry always forces a final event even if it lands inside the 100ms window, so you're guaranteed to see progress: 100.
  • tar.gz extraction estimates progress from compressed bytes read through the gzip stream (capped at 99 until fully done, since tar entries don't have a fixed upfront total), and posts a guaranteed final progress: 100 event once the whole stream has been consumed. If the archive size can't be determined, progress is reported as -1 for the in-between events.

Listening

Subscribe on the EventBus the event is posted to, see Events for which bus that is.

eventBus.subscribe(ExtractArchiveEvent.class, event -> {
    ArchiveType archiveType = event.archiveType();
    int progress = event.progress();
});

Posted by

API reference: com.dervarex.minified.java.events.extract.ExtractArchiveEvent