Decompressor
A stream reading decompressed bytes from a compressed source.
Returned by decompress. Handing it to a function
that takes an Io passes on the decompressed bytes, and the
stream stays open.
Inherits from: io.Io
Fields
format @ Format[get]The format being decompressed, as detected for
:AUTO:.
Methods
close()
Closes the stream, and its source if it was opened from a path. Closing again does nothing.
read … -> Bin
Reads decompressed bytes.
Reads to the end of the stream when size is omitted. With size, reads
that many bytes unless the end is reached first; an empty result means the
end.
Parameters
| Name | Type | Description |
|---|---|---|
size? |
Int |
Number of bytes to read; omit to read the rest of the stream. |
Errors
| Exception | Condition |
|---|---|
sys.InvalidDataError |
The compressed data is corrupt |
sys.UnexpectedEofError |
The compressed data ends partway through |
StateError |
The stream is closed |