שתף באמצעות


AsnDecoder.DecodeLength Method

Definition

Decodes the data in source as a length value under the specified encoding rules.

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

Parameters

source
ReadOnlySpan<Byte>

The buffer containing encoded data.

ruleSet
AsnEncodingRules

The encoding constraints to use when interpreting the data.

bytesConsumed
Int32

When this method returns, contains the number of bytes from the beginning of source that contributed to the length.

This parameter is treated as uninitialized.

Returns

The decoded value of the length, or null if the encoded length represents the indefinite length.

Exceptions

ruleSet is not a known AsnEncodingRules value.

source does not decode as a length under the specified encoding rules.

Remarks

This method only processes the length portion of an ASN.1/BER Tag-Length-Value triplet, so source needs to have already sliced off the encoded tag.

Applies to