Edit

Share via


Base64.EncodeToUtf8 Method

Definition

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

public static System.Buffers.OperationStatus EncodeToUtf8 (ReadOnlySpan<byte> bytes, Span<byte> utf8, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true);
static member EncodeToUtf8 : ReadOnlySpan<byte> * Span<byte> * int * int * bool -> System.Buffers.OperationStatus
Public Shared Function EncodeToUtf8 (bytes As ReadOnlySpan(Of Byte), utf8 As Span(Of Byte), ByRef bytesConsumed As Integer, ByRef bytesWritten As Integer, Optional isFinalBlock As Boolean = true) As OperationStatus

Parameters

bytes
ReadOnlySpan<Byte>

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

utf8
Span<Byte>

The output span that contains the result of the operation, that is, the UTF-8 encoded text in base 64.

bytesConsumed
Int32

When this method returns, contains the number of input bytes consumed during the operation. This can be used to slice the input for subsequent calls, if necessary.

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.

isFinalBlock
Boolean

true (the default) to indicate that the input span contains the entire data to encode. false to indicate that the input span contains partial data with more data to follow.

Returns

One of the enumeration values that indicates the status of the encoding operation.

Remarks

The return value can be as follows:

This method cannot return OperationStatus.InvalidData since that is not possible for base-64 encoding.

Applies to