Import std.io.memory
std.io.memory
Streams over memory: MemoryStream, bytes to read, write, and move around in, as a file's are; StringReader, which reads a String's UTF-8; and StringWriter, which collects text.
std/io/memory.fb
Types
MemoryStream
class
Public Class MemoryStream Implements Reader, Writer, Seeker
Bytes in memory that it reads, writes, and moves around in, as a file's are, from where it is, which they grow past as they're written. Writing past the end fills what's between with 0s.
-
One of a copy of the
bytes, from their start, or an empty one. -
How many bytes it has.
-
Reads up to into.Count bytes into the start of
into, and gives how many it read: one at least, or 0 once the stream has ended, or for an empty Buffer.Doc from
std.io.streams.Reader.Read. -
Writes all of from's bytes, in order.
Doc from
std.io.streams.Writer.Write. -
Moves to
offsetbytes fromorigin, and gives where that is from the start. A place before the start, or past what an Int64 counts, throws an IOError, and one past the end is the end for a Reader, and where a Writer writes next.Doc from
std.io.streams.Seeker.Seek. -
Its bytes, in a new array.
StringReader
class
Public Class StringReader Implements Reader, Seeker
Reads a String's UTF-8 bytes, and moves around in them.
-
A StringReader of
text's UTF-8 bytes. -
How many bytes the text has.
-
Reads up to into.Count bytes into the start of
into, and gives how many it read: one at least, or 0 once the stream has ended, or for an empty Buffer.Doc from
std.io.streams.Reader.Read. -
Moves to
offsetbytes fromorigin, and gives where that is from the start. A place before the start, or past what an Int64 counts, throws an IOError, and one past the end is the end for a Reader, and where a Writer writes next.Doc from
std.io.streams.Seeker.Seek.
StringWriter
class
Public Class StringWriter Implements Writer
Collects what's written to it, as text, which ToString gives.
-
A new StringWriter, with nothing written.
-
How many bytes it has.
-
Writes all of from's bytes, in order.
Doc from
std.io.streams.Writer.Write. -
What it has, as text, with U+FFFD for each byte that doesn't start well-formed UTF-8.
Report an issue with this page or with FutureBlitz on GitHub.