AsnDecoder.TryReadCharacterStringBytes Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
- 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
.NET