AsnDecoder.ReadCharacterString(ReadOnlySpan<Byte>, AsnEncodingRules, UniversalTagNumber, Int32, Nullable<Asn1Tag>) 方法

定义

读取下一个值,作为带有指定标记和编码类型的字符串值,以返回解码字符串。Reads the next value as character string with the specified tag and encoding type, returning the decoded string.

public static string ReadCharacterString (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.UniversalTagNumber encodingType, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadCharacterString : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * System.Formats.Asn1.UniversalTagNumber * int * Nullable<System.Formats.Asn1.Asn1Tag> -> string
Public Shared Function ReadCharacterString (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, encodingType As UniversalTagNumber, ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As String

参数

source
ReadOnlySpan<Byte>

包含编码数据的缓冲区。The buffer containing encoded data.

ruleSet
AsnEncodingRules

解释数据时要使用的编码约束。The encoding constraints to use when interpreting the data.

encodingType
UniversalTagNumber

枚举值之一,表示要处理的值类型。One of the enumeration values which represents the value type to process.

bytesConsumed
Int32

此方法返回时,为编码值的字节总数。When this method returns, the total number of bytes for the encoded value. 该参数未经初始化即被处理。This parameter is treated as uninitialized.

expectedTag
Nullable<Asn1Tag>

读取前要检查的标记,或使用 null 作为符合请求的编码类型的通用标记。The tag to check for before reading, or null for the universal tag that is appropriate to the requested encoding type.

返回

String

已解码的值。The decoded value.

例外

未定义 ruleSetruleSet is not defined. -或- encodingType 不是已知的字符串类型。-or- encodingType is not a known character string type.

下一个值没有正确的标记。the next value does not have the correct tag. -或- 在当前编码规则下,长度编码无效。-or- the length encoding is not valid under the current encoding rules. -或- 在当前编码规则下,内容无效。-or- the contents are not valid under the current encoding rules. -或- 字符串未成功解码。-or- the string did not successfully decode.

expectedTag.TagClassexpectedTag.TagClass Universal,但 expectedTag.TagValueis Universal, but expectedTag.TagValue encodingType 不同。is not the same as encodingType.

适用于