Concat
Reads the items of an iterable as one byte stream.
A Str or Bin item contributes its own bytes, and
anything else is converted to a string first, as
Io.(put) writes it. end follows every item.
Items are taken from the iterable only as reads need them, and bytes a read
leaves are kept for the next. A Concat reads, but does not write or seek. A
function that accepts an Io, such as
compress.decompress, can read it.
Errors
| Exception | Condition |
|---|---|
StateError |
The stream is closed |
TypeError |
end is not a Str or Bin |
An exception from the iterable is raised by the read that needed the item.
Example
Inherits from: Io
Constructor
Concat items …
Reads items in order.
Parameters
| Name | Type | Description |
|---|---|---|
items |
Iterable[Value] |
Items to read. |
:end? |
(Str | Bin) |
Bytes to follow every item. None by default. |
Fields
readable @ Bool[get]Whether the stream reads, which it does until it is closed.
Methods
close()
Closes the stream, dropping the iterable. Closing a closed stream does nothing.
read size -> Bin
Reads bytes.
Parameters
| Name | Type | Description |
|---|---|---|
size |
Int |
Number of bytes to read. |
Returns
At most size bytes, fewer only at the end of the items. An empty result
means the end of the stream.