extractToByteArray

@ObjCName(name = "extractToByteArray", swiftName = "extractToByteArray")
fun ArchiveEntry.extractToByteArray(reader: ArchiveReader): ByteArray(source)

Extracts the uncompressed content of this entry from reader into a new in-memory ByteArray.

Because the entire entry payload is buffered in memory, prefer streaming via extract with a file or network Sink when extracting large entries.

KioArch.createReader(archivePath).use { reader ->
val entry = reader.getEntries().first { !it.isDirectory }
val bytes = entry.extractToByteArray(reader)
}

Return

a ByteArray containing the decompressed bytes of this entry.

Parameters

reader

the open ArchiveReader from which this entry originated.

Throws

if decompression fails or an I/O error occurs.

if reader has already been closed.