Κοινή χρήση μέσω


AsnDecoder.TryReadCharacterStringBytes Method

Definition

Attempts to read a character string value from source with a specified tag under the specified encoding rules, copying the unprocessed bytes into the provided destination buffer.

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

Parameters

source
ReadOnlySpan<Byte>

The buffer containing encoded data.

destination
Span<Byte>

The buffer in which to write.

ruleSet
AsnEncodingRules

The encoding constraints to use when interpreting the data.

expectedTag
Asn1Tag

The tag to check for before reading.

bytesConsumed
Int32

When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.

bytesWritten
Int32

On success, receives the number of bytes written to destination.

Returns

true if destination is large enough to receive the value of the unprocessed character string; otherwise, false.

Exceptions

ruleSet is not defined.

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.TagClass is Universal, but expectedTag.TagValue is not a character string tag type.

-or-

destination overlaps source.

Remarks

This method does not determine if the string used only characters defined by the encoding.

Applies to