Class
MemoryStream
class MemoryStream
Module: System.IO
Assembly: System.Runtime.dll
Source file: MemoryStream.rvn
Inheritance: Object → MemoryStream
Implements: InputStream, OutputStream, SeekableStream, SyncInputStream, SyncOutputStream
Provisional managed byte stream implementing InputStream, OutputStream and SeekableStream with one shared cursor.
Remarks
Development after Preview 9. Starts empty; at most 65536 bytes. Synchronous, not thread-safe. Writes copy bytes and overwrite or extend storage. Seeking beyond length does not extend it; a later nonempty write zero-fills the gap. No array wrapping, exposed buffer, truncation or asynchronous operations. Close releases the backing storage and all later operations return Closed.
Constructors
1 item
MemoryStream()
Creates an empty readable, writable and seekable stream at position zero.
Methods
14 items
Close() -> ()
Closes all capabilities and releases the backing storage. Repeated calls have no effect.
Implements InputStream.Close, OutputStream.Close, SyncInputStream.Close, SyncOutputStream.Close
Equals(other: object?) -> bool
Tests reference identity by default; an ordinary class may override equality.
Inherited from Object.Equals
Flush() -> Result<void, StreamError>
Flushes implementation buffers, without implying durable storage or peer receipt.
Required implementation (no default). Defined by SyncOutputStream.Flush · Defined by SyncOutputStream.Flush
Flush(cancellationToken?: CancellationToken) -> Task<Result<void, StreamError>>
Returns settled success for open memory storage; no data needs flushing.
Implements OutputStream.Flush
GetHashCode() -> int
Returns a stable identity hash by default; an ordinary class may override it consistently with equality.
Inherited from Object.GetHashCode
GetLength() -> Result<long, StreamError>
Gets the current byte length, or Closed after closing.
GetPosition() -> Result<long, StreamError>
Gets the shared read/write byte position, or Closed after closing.
Implements SeekableStream.GetPosition
GetType() -> TypeInfo
Returns metadata for the concrete runtime type of this instance.
Inherited from Object.GetType
Read(buffer: Slice<byte>) -> Result<int, StreamError>
Reads up to buffer.Length bytes; short reads are successful.
Required implementation (no default). Defined by SyncInputStream.Read · Defined by SyncInputStream.Read
Read(buffer: byte[], offset: int, count: int, cancellationToken?: CancellationToken) -> Task<Result<int, StreamError>>
Reads memory synchronously and returns a settled task; no worker is scheduled.
Implements InputStream.Read
Seek(position: long) -> Result<long, StreamError>
Sets the absolute shared position without changing length.
Implements SeekableStream.Seek
ToString() -> string
Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override.
Inherited from Object.ToString
Write(buffer: ReadOnlySlice<byte>) -> Result<void, StreamError>
Writes the entire borrowed source range.
Required implementation (no default). Defined by SyncOutputStream.Write · Defined by SyncOutputStream.Write
Write(buffer: byte[], offset: int, count: int, cancellationToken?: CancellationToken) -> Task<Result<void, StreamError>>
Writes the full range to memory and returns a settled task.
Implements OutputStream.Write