Edit

Share via


Base64Url.TryEncodeToUtf8 Method

Definition

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

public:
 static bool TryEncodeToUtf8(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryEncodeToUtf8 (ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryEncodeToUtf8 : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryEncodeToUtf8 (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 binary data that needs to be encoded.

destination
Span<Byte>

The output span which contains the result of the operation, i.e. the UTF-8 encoded text in Base64Url.

bytesWritten
Int32

When this method returns, contains the number of chars 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 encoded successfully; false if destination is too small.

Remarks

This implementation of the base64url encoding omits the optional padding characters.

Applies to