AsnReader.TryReadCharacterStringBytes(Span<Byte>, Asn1Tag, Int32) 方法

定义

读取下一个值,作为带有指定标记的字符串值,并将未处理的字节复制到所提供的目标缓冲区。Reads the next value as character string with the specified tag, copying the unprocessed bytes into a provided destination buffer.

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

参数

destination
Span<Byte>

要写入的缓冲区。The buffer in which to write.

expectedTag
Asn1Tag

读取前要检查的标记。The tag to check for before reading.

bytesWritten
Int32

成功后,将收到已写入 destination 的字节数。On success, receives the number of bytes written to destination.

返回

Boolean

如果 destination 有足够的长度来接收值,则为 true 并推进读取器,否则为 false,且读取器不会前进。true and advances the reader if destination had sufficient length to receive the value, otherwise false and the reader does not advance.

例外

下一个值没有正确的标记。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.

expectedTag.TagClassexpectedTag.TagClass Universal,但 expectedTag.TagValueis Universal, but expectedTag.TagValue 不是字符串标记类型。is not a character string tag type.

注解

此方法不确定字符串是否只使用编码所定义的字符。This method does not determine if the string used only characters defined by the encoding.

适用于