stream
Warning
std/stream is currently unstable and is subject to change. Do not use this until
this warning is removed.
enum StreamSeek
An enum used for where a stream should seek from when seek is called. These
are the members:
StreamSeek.StartStreamSeek.CurrentStreamSeek.End
struct Stream
Stream is a general purpose interface for streams. It can be used if you want to re-use code for files stored on the disk or in memory, for example.
Members
addr data- This can be used by the read/write functions to store dataaddr read- A function used for reading, parameters areaddr buffer cell count ptr Stream streamaddr write- A function used for writing, parameters areaddr buffer cell count ptr Stream streamaddr seek- A function used to seek in a stream, parameters arecell offset StreamSeek whence ptr Stream streamaddr tell- A function that takes aptr Streamparameter and returns the offset where the stream is
stream@
Parameters: addr buffer, cell count, ptr Stream stream
Reads count bytes from stream and writes them to buffer
stream!
Parameters: addr buffer, cell count, ptr Stream stream
Writes count bytes from buffer to stream
stream_seek
Parameters: cell offset, StreamSeek whence, ptr Stream stream
Seeks to offset from whence in stream
If whence is StreamSeek.Start, it seeks to offset bytes from the start.
If whence is StreamSeek.Current, it seeks to where it currently is + offset
If whence is StreamSeek.End, it seeks to the end + offset. This means offset
should be zero.
stream_tell
Parameters: ptr Stream stream
Returns: cell offset
Returns the offset that the stream is seeked at