internal string ReadCharacterString(UniversalTagNumber encodingType, Asn1Tag?expectedTag = default) { string ret = AsnDecoder.ReadCharacterString(_span, _ruleSet, encodingType, out int consumed, expectedTag); _span = _span.Slice(consumed); return(ret); }
/// <summary> /// Reads the next value as character string with the specified tag and /// encoding type, returning the decoded value as a string. /// </summary> /// <param name="encodingType"> /// One of the enumeration values representing the value type to process. /// </param> /// <param name="expectedTag"> /// The tag to check for before reading, or <see langword="null"/> for the universal tag that is /// appropriate to the requested encoding type. /// </param> /// <returns> /// The decoded value. /// </returns> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="encodingType"/> is not a known character string type. /// </exception> /// <exception cref="AsnContentException"> /// 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. /// /// -or- /// /// the string did not successfully decode. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is /// <see cref="TagClass.Universal"/>, but /// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not the same as /// <paramref name="encodingType"/>. /// </exception> /// <seealso cref="TryReadPrimitiveCharacterStringBytes"/> /// <seealso cref="TryReadCharacterStringBytes"/> /// <seealso cref="TryReadCharacterString"/> public string ReadCharacterString(UniversalTagNumber encodingType, Asn1Tag?expectedTag = null) { string ret = AsnDecoder.ReadCharacterString( _data.Span, RuleSet, encodingType, out int consumed, expectedTag); _data = _data.Slice(consumed); return(ret); }