語言

AsnDecoder.TryReadOctetString 方法

定義

嘗試從指定標籤中取得八重奏字串值 source ,並依指定編碼規則將該值複製至指定的目的緩衝區。

public static bool TryReadOctetString(ReadOnlySpan<byte> source, Span<byte> destination, System.Formats.Asn1.AsnEncodingRules ruleSet, out int bytesConsumed, out int bytesWritten, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member TryReadOctetString : ReadOnlySpan<byte> * Span<byte> * System.Formats.Asn1.AsnEncodingRules * int * int * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Shared Function TryReadOctetString (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ruleSet As AsnEncodingRules, ByRef bytesConsumed As Integer, ByRef bytesWritten As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Boolean

參數

source
ReadOnlySpan<Byte>

緩衝區內包含編碼資料。

destination
Span<Byte>

用來寫入的緩衝區。

ruleSet
AsnEncodingRules

解讀資料時應使用的編碼約束。

bytesConsumed
Int32

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

bytesWritten
Int32

當此方法返回時,寫入的 destination總位元組數為 。 此參數被視為未初始化。

expectedTag
Nullable<Asn1Tag>

閱讀前要先檢查的標籤,或 null 是預設標籤(Universal 4)。

傳回

true如果 destination 足夠大以接收八重奏串的值;否則,。 false

例外狀況

ruleSet 尚未定義。

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

-或-

長度編碼在現行編碼規則下不適用。

-或-

內容在現行編碼規則下無效。

expectedTag。TagClass 是 Universal,但 expectedTag。TagValue 對該方法來說並不正確。

-或-

destination重疊。source

適用於

另請參閱