Edit

Share via


Base64Url.TryEncodeToUtf8InPlace(Span<Byte>, Int32, Int32) Method

Definition

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).

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

Parameters

buffer
Span<Byte>

The input span which contains binary data that needs to be encoded.

It needs to be large enough to fit the result of the operation.

dataLength
Int32

The amount of binary data contained within the buffer that needs to be encoded

(and needs to be smaller than the buffer length).

bytesWritten
Int32

When this method returns, contains the number of bytes written into the buffer. 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