Edit

Share via


Base64Url.TryDecodeFromUtf8 Method

Definition

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

public:
 static bool TryDecodeFromUtf8(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryDecodeFromUtf8 (ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryDecodeFromUtf8 : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryDecodeFromUtf8 (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

source
ReadOnlySpan<Byte>

The input span which contains UTF-8 encoded text in Base64Url that needs to be decoded.

destination
Span<Byte>

The output span which contains the result of the operation, i.e. the decoded binary data.

bytesWritten
Int32

When this method returns, contains the number of bytes written into the output span. This can be used to slice the output for subsequent calls, if necessary. This parameter is treated as uninitialized.

Returns

true if bytes decoded successfully; false if destination is too small.

Exceptions

source contains an invalid Base64Url character,

more than two padding characters, or a non white space character among the padding characters.

Applies to