class · System.IO

MemoryStream

public class System.IO.MemoryStream : System.IO.Stream

Bytes kept in an array that grows as it is written (or in a fixed array given to it).

Kind
class
Namespace
System.IO
Assembly
System.Core
Access
public
Source file
Stream.ant

Inheritance

Base classes
Any Stream MemoryStream

Constructors

constructor MemoryStream()
#
constructor MemoryStream(capacity: i32)
#
constructor MemoryStream(buffer: u8[])
#

Over buffer (its bytes are the stream's, it does not grow).

constructor MemoryStream(buffer: u8[], writable: bool)
#

Properties

property CanRead: bool
#

read-only

property CanWrite: bool
#

read-only

property CanSeek: bool
#

read-only

property Length: i64
#

read-only

property Position: i64
#
property Capacity: i32
#

read-only

How many bytes fit before it grows.

Methods

method Read(buffer: u8[], offset: i32, count: i32) -> i32
#

override

method ReadByte() -> i32
#

override

method Write(buffer: u8[], offset: i32, count: i32) -> void
#

override

method WriteByte(value: u8) -> void
#

override

method Seek(offset: i64, origin: System.IO.SeekOrigin) -> i64
#

override

method SetLength(newLength: i64) -> void
#

override

method Close() -> void
#

override

method ToArray() -> u8[]
#

A copy of its bytes.

method GetBuffer() -> u8[]
#

The array it keeps its bytes in (Length of them are the stream's).

method WriteTo(destination: System.IO.Stream) -> void
#

Writes all its bytes into destination.

Private and internal members (13)

field data: u8[]
#

private

field length: i32
#

private

field position: i32
#

private

field writable: bool
#

private

field growable: bool
#

private

field open: bool
#

private

field room: i32
#

private

Where a write can go without the slow path: data.Length when open and writable, else 0.

static method Closed() -> void
#

private static

The throw is kept out of the methods that check (so they stay small enough to inline).

static method ReadOnly() -> void
#

private static

method Check() -> void
#

private

method Reserve(needed: i32) -> void
#

private

Room for at least needed bytes.

method Grow(needed: i32) -> void
#

private

method WriteByteSlow(value: u8) -> void
#

private

Inherited members (12)

Source

MemoryStream as Larva HIR, decompiled from its Larva HIR.

System.IO.MemoryStream.hir
// Bytes kept in an array that grows as it is written (or in a fixed array given to it).
public class System.IO.MemoryStream : System.IO.Stream
{
    field data: u8[]
    field length: i32
    field position: i32
    field writable: bool
    field growable: bool
    field open: bool
    // Where a write can go without the slow path: data.Length when open and writable, else 0.
    field room: i32
    // The throw is kept out of the methods that check (so they stay small enough to inline).
    static method Closed() -> void
    static method ReadOnly() -> void
    method Check() -> void
    // Room for at least `needed` bytes.
    method Reserve(needed: i32) -> void
    method Grow(needed: i32) -> void
    method WriteByteSlow(value: u8) -> void
    constructor MemoryStream()
    constructor MemoryStream(capacity: i32)
    // Over `buffer` (its bytes are the stream's, it does not grow).
    constructor MemoryStream(buffer: u8[])
    constructor MemoryStream(buffer: u8[], writable: bool)
    method Read(buffer: u8[], offset: i32, count: i32) -> i32
    method ReadByte() -> i32
    method Write(buffer: u8[], offset: i32, count: i32) -> void
    method WriteByte(value: u8) -> void
    method Seek(offset: i64, origin: System.IO.SeekOrigin) -> i64
    method SetLength(newLength: i64) -> void
    method Close() -> void
    // A copy of its bytes.
    method ToArray() -> u8[]
    // The array it keeps its bytes in (Length of them are the stream's).
    method GetBuffer() -> u8[]
    // Writes all its bytes into `destination`.
    method WriteTo(destination: System.IO.Stream) -> void
    property CanRead: bool
    property CanWrite: bool
    property CanSeek: bool
    property Length: i64
    property Position: i64
    // How many bytes fit before it grows.
    property Capacity: i32
}
Esc