語言

AsnDecoder.TryReadCharacterStringBytes 方法

定義

嘗試根據指定的編碼規則,將未處理的位元組複製到指定的目的緩衝區,並以指定標籤讀取字元字串值 source 。

public:
 static bool TryReadCharacterStringBytes(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, System::Formats::Asn1::AsnEncodingRules ruleSet, System::Formats::Asn1::Asn1Tag expectedTag, [Runtime::InteropServices::Out] int % bytesConsumed, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryReadCharacterStringBytes(ReadOnlySpan<byte> source, Span<byte> destination, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.Asn1Tag expectedTag, out int bytesConsumed, out int bytesWritten);
static member TryReadCharacterStringBytes : ReadOnlySpan<byte> * Span<byte> * System.Formats.Asn1.AsnEncodingRules * System.Formats.Asn1.Asn1Tag * int * int -> bool
Public Shared Function TryReadCharacterStringBytes (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ruleSet As AsnEncodingRules, expectedTag As Asn1Tag, ByRef bytesConsumed As Integer, ByRef bytesWritten As Integer) As Boolean

參數

source
ReadOnlySpan<Byte>

緩衝區內包含編碼資料。

destination
Span<Byte>

用來寫入的緩衝區。

ruleSet
AsnEncodingRules

解讀資料時應使用的編碼約束。

expectedTag
Asn1Tag

閱讀前要先確認標籤。

bytesConsumed
Int32

當此方法回傳時,會顯示編碼值的總位元組數。 此參數被視為未初始化。

bytesWritten
Int32

成功時,會收到寫入 destination的位元組數。

傳回

true 如果 destination 足夠大以接收未處理字串的值;否則, false。

例外狀況

ruleSet 尚未定義。

下一個值沒有正確的標籤。

-或-

長度編碼在現行編碼規則下不適用。

-或-

內容在現行編碼規則下無效。

expectedTag。TagClass 是 Universal,但 expectedTag。TagValue 不是字串標籤類型。

-或-

destination重疊。source

備註

此方法無法判斷字串是否僅使用編碼定義的字元。

適用於

另請參閱