API ReferenceSandbox
public sealed struct Sandbox.ByteStream
Write and read bytes to a stream. This aims to be as allocation free as possible while also being as fast as possible.
Related Guides
Broader workflow and conceptual references connected to this API.
Methods
Showing 25 methods
public Sandbox.ByteStream Compress(System.IO.Compression.CompressionLevel compressionLevel = 0)
Parameters
compressionLevel: Default: 0
public static Sandbox.ByteStream Create(int size)
Create a writable byte stream
public static Sandbox.ByteStream CreateReader(System.ReadOnlySpan`1<byte> data)
public Sandbox.ByteStream Decompress()
public void Dispose()
public void EnsureCanRead(int size)
Validates read bounds with overflow protection
public void EnsureCanWrite(int size)
Ensures buffer can accommodate write with overflow protection
public T[] ReadArray(int maxElements = 1073741823)
Returns an array of unmanaged types
Parameters
maxElements: Default: 1073741823
public object ReadObject(System.Type objectType)
public byte[] ToArray()
Get the data as an array of bytes
public bool TryRead(T v)
Try to read variable, return false if not enough data
No results match this filter.
Properties
Showing 4 properties
public int Sandbox.ByteStream.Length { get; set; }
The total size of the data
public int Sandbox.ByteStream.Position { get; set; }
The current read or write position. Values are clamped to valid range.
public int Sandbox.ByteStream.ReadRemaining { get; set; }
public bool Sandbox.ByteStream.Writable { get; set; }
Is this stream writable?
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.System |
| Doc ID | T:Sandbox.ByteStream |