Archive Reader
Reads metadata and extracts entries on demand from an open archive.
An ArchiveReader holds native decoder state and an underlying SeekableSource. Always close the reader when finished—typically via .use { ... }—to release native memory and close the underlying SeekableSource.
Thread Safety and Re-entrancy
Implementations synchronize access to the underlying native handle so concurrent calls across threads are serialized safely. However, invoking ArchiveReader methods re-entrantly from within a SeekableSource or Sink callback during an active operation is prohibited and throws IllegalStateException.
Usage Example
KioArch.createReader(archiveBytes).use { reader ->
val target = reader.getEntries().first { !it.isDirectory && it.name.endsWith(".txt") }
val buffer = kotlinx.io.Buffer()
reader.extractEntry(target, buffer)
println(buffer.readString())
}Content copied to clipboard
See also
Inheritors
Functions
Link copied to clipboard
Link copied to clipboard
Returns all file and directory entries recorded in the archive.