<PackageReference Include="Microsoft.Bcl.Memory" Version="11.0.0-preview.4.26230.115" />

System.Buffers.Text.Base64Url

public static class Base64Url
public static OperationStatus DecodeFromChars(ReadOnlySpan<char> source, Span<byte> destination, out int charsConsumed, out int bytesWritten, bool isFinalBlock = true)

Decodes the span of unicode ASCII chars represented as Base64Url into binary data.

public static int DecodeFromChars(ReadOnlySpan<char> source, Span<byte> destination)

Decodes the span of unicode ASCII chars represented as Base64Url into binary data.

public static byte[] DecodeFromChars(ReadOnlySpan<char> source)

Decodes the span of unicode ASCII chars represented as Base64Url into binary data.

public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true)

Decodes the span of UTF-8 encoded text represented as Base64Url into binary data.

public static int DecodeFromUtf8(ReadOnlySpan<byte> source, Span<byte> destination)

Decodes the span of UTF-8 encoded text represented as Base64Url into binary data.

public static byte[] DecodeFromUtf8(ReadOnlySpan<byte> source)

Decodes the span of UTF-8 encoded text represented as Base64Url into binary data.

public static int DecodeFromUtf8InPlace(Span<byte> buffer)

Decodes the span of UTF-8 encoded text in Base64Url into binary data, in-place. The decoded binary output is smaller than the text data contained in the input (the operation deflates the data).

public static OperationStatus EncodeToChars(ReadOnlySpan<byte> source, Span<char> destination, out int bytesConsumed, out int charsWritten, bool isFinalBlock = true)

Encodes the span of binary data into unicode ASCII chars represented as Base64Url.

public static int EncodeToChars(ReadOnlySpan<byte> source, Span<char> destination)

Encodes the span of binary data into unicode ASCII chars represented as Base64Url.

public static char[] EncodeToChars(ReadOnlySpan<byte> source)

Encodes the span of binary data into unicode ASCII chars represented as Base64Url.

public static string EncodeToString(ReadOnlySpan<byte> source)

Encodes the span of binary data into unicode string represented as Base64Url ASCII chars.

public static OperationStatus EncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true)

Encodes the span of binary data into UTF-8 encoded text represented as Base64Url.

public static int EncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> destination)

Encodes the span of binary data into UTF-8 encoded text represented as Base64Url.

public static byte[] EncodeToUtf8(ReadOnlySpan<byte> source)

Encodes the span of binary data into UTF-8 encoded text represented as Base64Url.

public static int GetEncodedLength(int bytesLength)

Returns the length (in bytes) of the result if you were to encode binary data within a byte span of size bytesLength.

public static int GetMaxDecodedLength(int base64Length)

Returns the maximum length (in bytes) of the result if you were to decode base 64 encoded text from a span of size base64Length.

public static bool IsValid(ReadOnlySpan<char> base64UrlText)

Validates that the specified span of text is comprised of valid base-64 encoded data.

public static bool IsValid(ReadOnlySpan<char> base64UrlText, out int decodedLength)

Validates that the specified span of text is comprised of valid base-64 encoded data.

public static bool IsValid(ReadOnlySpan<byte> utf8Base64UrlText)

Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data.

public static bool IsValid(ReadOnlySpan<byte> utf8Base64UrlText, out int decodedLength)

Validates that the specified span of UTF-8 text is comprised of valid base-64 encoded data.

public static bool TryDecodeFromChars(ReadOnlySpan<char> source, Span<byte> destination, out int bytesWritten)

Decodes the span of unicode ASCII chars represented as Base64Url into binary data.

public static bool TryDecodeFromUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)

Decodes the span of UTF-8 encoded text represented as Base64Url into binary data.

public static bool TryEncodeToChars(ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten)

Encodes the span of binary data into unicode ASCII chars represented as Base64Url.

public static bool TryEncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)

Encodes the span of binary data into UTF-8 encoded chars represented as Base64Url.

public static bool TryEncodeToUtf8InPlace(Span<byte> buffer, int dataLength, out int bytesWritten)

Encodes the span of binary data (in-place) into UTF-8 encoded text represented as base 64. The encoded text output is larger than the binary data contained in the input (the operation inflates the data).