Search Results for

    Show / Hide Table of Contents

    Struct PooledBytes

    • ArrayPool-backed owned byte buffer.
    • Call Dispose() to return buffer to pool.
    • Ownership is transferred to the consumer when passed downstream.
    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Glitch9.IO
    Assembly: Glitch9.IO.dll
    Syntax
    public readonly struct PooledBytes : IDisposable

    Constructors

    | Edit this page View Source

    PooledBytes(byte[], int)

    Declaration
    public PooledBytes(byte[] array, int length)
    Parameters
    Type Name Description
    byte[] array
    int length

    Properties

    | Edit this page View Source

    Array

    Declaration
    public byte[] Array { get; }
    Property Value
    Type Description
    byte[]
    | Edit this page View Source

    IsEmpty

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Length

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    AsMemory()

    Declaration
    public ReadOnlyMemory<byte> AsMemory()
    Returns
    Type Description
    ReadOnlyMemory<byte>
    | Edit this page View Source

    AsSpan()

    Declaration
    public ReadOnlySpan<byte> AsSpan()
    Returns
    Type Description
    ReadOnlySpan<byte>
    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()
    | Edit this page View Source

    FromBase64StringOrThrow(string)

    • Throws FormatException on invalid Base64.
    • Caller must Dispose() returned PooledBytes.
    Declaration
    public static PooledBytes FromBase64StringOrThrow(string base64)
    Parameters
    Type Name Description
    string base64
    Returns
    Type Description
    PooledBytes
    | Edit this page View Source

    TryFromBase64Chars(ReadOnlySpan<char>, out PooledBytes)

    • Decodes Base64 chars into a pooled byte buffer.
    • Uses Convert.TryFromBase64Chars (handles whitespace).
    • Caller must Dispose() the result on success.
    Declaration
    public static bool TryFromBase64Chars(ReadOnlySpan<char> base64Chars, out PooledBytes bytes)
    Parameters
    Type Name Description
    ReadOnlySpan<char> base64Chars
    PooledBytes bytes
    Returns
    Type Description
    bool
    | Edit this page View Source

    TryFromBase64String(string, out PooledBytes)

    • Decodes Base64 string into a pooled byte buffer.
    • Returns false on invalid Base64; rented buffer is returned to pool.
    • Caller owns the returned PooledBytes and must Dispose() it.
    Declaration
    public static bool TryFromBase64String(string base64, out PooledBytes bytes)
    Parameters
    Type Name Description
    string base64
    PooledBytes bytes
    Returns
    Type Description
    bool
    | Edit this page View Source

    TryFromBase64Utf8(ReadOnlySpan<byte>, out PooledBytes)

    • Decodes Base64 UTF8 bytes into a pooled byte buffer.
    • Uses System.Buffers.Text.Base64 (fast path for UTF8 input).
    • Caller must Dispose() the result on success.
    Declaration
    public static bool TryFromBase64Utf8(ReadOnlySpan<byte> base64Utf8, out PooledBytes bytes)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> base64Utf8
    PooledBytes bytes
    Returns
    Type Description
    bool

    Implements

    IDisposable

    Extension Methods

    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetHashCodeOrDefault<T>(T)
    SystemExtensions.TryDispose(IDisposable)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation