Show / Hide Table of Contents

TlvReader Class

Namespace: Yubico.Core.Tlv Assembly: Yubico.Core.dll

Use this class to parse TLV (tag-length-value) constructions.

C#
public sealed class TlvReader
Inheritance object TlvReader

Remarks

See the User's Manual entry on TLV for an in-depth discussion of what TLV is and a general description of how to use this class.

Constructors

Name Description
TlvReader(ReadOnlyMemory<byte>)

Build a new Reader object based on the given encoding.

Properties

Name Description
HasData

Indicates whether there is more data to read or not.

Methods

Name Description
PeekLength(int)

Skip the tagLength bytes and read the length octets, decode and return the length without advancing the reader.

PeekTag(int)

Read the tag at the current data position, without advancing the reader.

ReadByte(int)

Read the TLV at the current position, return the value as a byte, and move the position to the byte beyond the current TLV.

ReadEncoded(int)

Return the entire encoding of the next element.

ReadInt16(int, bool)

Read the TLV at the current position, return the value as a short (a two-byte integer), and move the position to the byte beyond the current TLV.

ReadInt32(int, bool)

Read the TLV at the current position, return the value as an int (a four-byte integer), and move the position to the byte beyond the current TLV.

ReadNestedTlv(int)

Read the TLV at the current position as a NestedTlv. Return a new TlvReader object whose position is the beginning of the NestedTlv's value, which is the tag of the NestedTlv's first sub-element. Move the position of the original reader to the byte beyond the current TLV.

ReadString(int, Encoding)

Read the TLV at the current position, return the value as a string, and move the position to the byte beyond the current TLV.

ReadUInt16(int, bool)

Read the TLV at the current position, return the value as an unsigned short (a two-byte unsigned integer), and move the position to the byte beyond the current TLV.

ReadValue(int)

Read the TLV at the current position, return the value as a byte array, and move the position to the byte beyond the current TLV.

TryReadByte(out byte, int)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to the byte that is the V part of the TLV, and move the position to the byte beyond the current TLV.

TryReadEncoded(out ReadOnlyMemory<byte>, int)

Try to read the TLV at the current position. If this succeeds, return true and set the encoded argument to a new ReadOnlyMemory object containing the full TLV, and move the position to the byte beyond the current TLV.

TryReadInt16(out short, int, bool)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to the short that is the V part of the TLV, and move the position to the byte beyond the current TLV.

TryReadInt32(out int, int, bool)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to the int that is the V part of the TLV, and move the position to the byte beyond the current TLV.

TryReadNestedTlv(out TlvReader, int)

Try to read the TLV at the current position as a NestedTlv. If this succeeds, return true and set the nestedReader argument to a new TlvReader object whose position is the beginning of the NestedTlv's value, which is the tag of the NestedTlv's first sub-element. Move the position of the original reader to the byte beyond the current TLV.

TryReadString(out string, int, Encoding)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to a string, and move the position to the byte beyond the current TLV.

TryReadUInt16(out ushort, int, bool)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to the unsigned short that is the V part of the TLV, and move the position to the byte beyond the current TLV.

TryReadValue(out ReadOnlyMemory<byte>, int)

Try to read the TLV at the current position. If this succeeds, return true and set the value argument to a new ReadOnlyMemory object containing the value as a byte array, and move the position to the byte beyond the current TLV.

In this article
Back to top Generated by DocFX