Base64.EncodeToUtf8InPlace(Span<Byte>, Int32, Int32) 方法
定义
将二进制数据(就地)的范围编码为以 base 64 表示的 UTF-8 编码的文本。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 System::Buffers::OperationStatus EncodeToUtf8InPlace(Span<System::Byte> buffer, int dataLength, [Runtime::InteropServices::Out] int % bytesWritten);
public static System.Buffers.OperationStatus EncodeToUtf8InPlace (Span<byte> buffer, int dataLength, out int bytesWritten);
static member EncodeToUtf8InPlace : Span<byte> * int * int -> System.Buffers.OperationStatus
Public Shared Function EncodeToUtf8InPlace (buffer As Span(Of Byte), dataLength As Integer, ByRef bytesWritten As Integer) As OperationStatus
参数
包含需要编码的二进制数据的输入范围。The input span that contains binary data that needs to be encoded. 由于此方法执行就地转换,因此它需要具有足够大小来存储操作结果。Because the method performs an in-place conversion, it needs to be large enough to store the result of the operation.
- dataLength
- Int32
包含在需要编码的缓冲区内的二进制数据的字节数。The number of bytes of binary data contained within the buffer that needs to be encoded. 此值必须小于缓冲区长度。This value must be smaller than the buffer length.
- bytesWritten
- Int32
写入缓冲区的字节数。The number of bytes written into the buffer.
返回
用于指示编码操作状态的枚举值之一。One of the enumeration values that indicates the status of the encoding operation.
注解
返回值可以为,如下所示:The return value can be as follows:
- OperationStatus.Done:整个缓冲区的处理成功。OperationStatus.Done: Processing of the entire buffer succeeded.
- OperationStatus.DestinationTooSmall:缓冲区中的空间不足
dataLength,无法满足输入编码的结果。OperationStatus.DestinationTooSmall: There isn't enough space in the buffer beyonddataLengthto fit the result of encoding the input.
此方法不能返回 OperationStatus.NeedMoreData 和 OperationStatus.InvalidData 。This method cannot return OperationStatus.NeedMoreData and OperationStatus.InvalidData.