Struct PooledBytes
- ArrayPool-backed owned byte buffer.
- Call Dispose() to return buffer to pool.
- Ownership is transferred to the consumer when passed downstream.
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
|
Edit this page
View Source
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
|
Edit this page
View Source
Length
Declaration
public int Length { get; }
Property Value
Methods
|
Edit this page
View Source
AsMemory()
Declaration
public ReadOnlyMemory<byte> AsMemory()
Returns
|
Edit this page
View Source
AsSpan()
Declaration
public ReadOnlySpan<byte> AsSpan()
Returns
|
Edit this page
View Source
Dispose()
Declaration
|
Edit this page
View Source
FromBase64StringOrThrow(string)
Declaration
public static PooledBytes FromBase64StringOrThrow(string base64)
Parameters
| Type |
Name |
Description |
| string |
base64 |
|
Returns
|
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
Returns
|
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
Returns
|
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
Returns
Implements
Extension Methods