Base64.EncodeToUtf8 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| EncodeToUtf8(ReadOnlySpan<Byte>, Span<Byte>) | |
| EncodeToUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean) |
將二進位資料的範圍編碼為UTF-8編碼文字,以64進位表示。 |
| EncodeToUtf8(ReadOnlySpan<Byte>) |
EncodeToUtf8(ReadOnlySpan<Byte>, Span<Byte>)
public:
static int EncodeToUtf8(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination);
public static int EncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> destination);
static member EncodeToUtf8 : ReadOnlySpan<byte> * Span<byte> -> int
Public Shared Function EncodeToUtf8 (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte)) As Integer
參數
- source
- ReadOnlySpan<Byte>
傳回
適用於
EncodeToUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean)
將二進位資料的範圍編碼為UTF-8編碼文字,以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
參數
- bytes
- ReadOnlySpan<Byte>
輸入區間包含需要編碼的二進位資料。
- bytesConsumed
- Int32
當此方法回傳時,包含操作過程中消耗的輸入位元組數。 若有需要,這可以用來切片後續呼叫的輸入。
- bytesWritten
- Int32
當此方法回傳時,包含寫入輸出區間的位元組數。 若有需要,這可用來切片後續呼叫的輸出。
- isFinalBlock
- Boolean
true (預設值)表示輸入區間包含整個需編碼的資料。
false 表示輸入區間包含部分資料,後續會有更多資料。
傳回
其中一個列舉值,用來表示編碼操作的狀態。
備註
回傳值可為如下:
- OperationStatus.Done:完整輸入區段的處理成功。
- OperationStatus.DestinationTooSmall:輸出區間空間不足以容納編碼輸入。
-
OperationStatus.NeedMoreData:
isFinalBlock是false。 否則,若isFinalBlock是true,則輸出被填充,且輸入不是 3 的倍數。
此方法無法回傳,因為 64 進制編碼無法回傳 OperationStatus.InvalidData 。
適用於
EncodeToUtf8(ReadOnlySpan<Byte>)
public:
static cli::array <System::Byte> ^ EncodeToUtf8(ReadOnlySpan<System::Byte> source);
public static byte[] EncodeToUtf8(ReadOnlySpan<byte> source);
static member EncodeToUtf8 : ReadOnlySpan<byte> -> byte[]
Public Shared Function EncodeToUtf8 (source As ReadOnlySpan(Of Byte)) As Byte()
參數
- source
- ReadOnlySpan<Byte>
傳回
Byte[]