Share via


AsnDecoder.TryReadPrimitiveCharacterStringBytes 方法

定義

如果值包含在單一 (基本) 編碼中,則嘗試在指定的編碼規則下,從 source 取得具有所指定標籤的未處理字元字串值。

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

參數

source
ReadOnlySpan<Byte>

包含編碼資料的緩衝區。

ruleSet
AsnEncodingRules

要在解譯資料時使用的編碼條件約束。

expectedTag
Asn1Tag

要在讀取之前檢查的標籤。

value
ReadOnlySpan<Byte>

成功時,會收到輸入緩衝區的配量,其對應至位元字串的值。 這個參數會被視為未初始化。

bytesConsumed
Int32

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

傳回

如果字元字串值具有基本編碼,則為 true,否則為 false

例外狀況

未定義ruleSet

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

-或-

目前編碼規則下的長度編碼無效。

-或-

內容在目前的編碼規則下無效。

expectedTagTagClassUniversal,但 expectedTagTagValue 不是字元字串標記類型。

備註

這個方法不會判斷字串是否只使用編碼所定義的字元。

適用於