Import std.io.memory
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.
Examples
Local memory = MemoryStream()
Try memory.WriteText("hello")
Expect(memory.Count == 5)
Try memory.Seek(1, SeekOrigin.START)
Expect((Try ReadAllText(memory)) == "ello")-
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 from where it is into
into, moves on past them, and gives how many, or 0 at its end. -
Writes from's bytes where it is, over what's there and past its end, and moves on past them. Throws an IOError when it would hold more than 2147483647 bytes.
-
Moves to
offsetbytes fromorigin, which can be past its end, where a Write fills what's between with zeros, and gives where it is now. Throws an IOError before its start. -
Its bytes, in a new array.
Report an issue with this page or with FutureBlitz on GitHub.