Class DnsBufferReader
- Namespace
- AppleTvControlLibrary.Discovery.Dns
- Assembly
- AppleTvControlLibrary.Discovery.dll
A minimal big-endian binary cursor over a byte buffer, used for the DNS wire format.
public sealed class DnsBufferReader
- Inheritance
-
DnsBufferReader
- Inherited Members
Remarks
Initializes a new instance of the DnsBufferReader class.
Constructors
DnsBufferReader(byte[])
A minimal big-endian binary cursor over a byte buffer, used for the DNS wire format.
public DnsBufferReader(byte[] buffer)
Parameters
bufferbyte[]The buffer to read from.
Remarks
Initializes a new instance of the DnsBufferReader class.
Properties
HasData
Gets a value indicating whether there is unread data remaining in the buffer.
public bool HasData { get; }
Property Value
Length
Gets the total length of the buffer, in bytes.
public int Length { get; }
Property Value
Position
Gets or sets the current read position, in bytes, into the buffer.
public int Position { get; set; }
Property Value
Methods
ReadByte()
Reads a single byte and advances the position by one.
public byte ReadByte()
Returns
- byte
The byte read.
ReadBytes(int)
Reads a number of bytes and advances the position accordingly.
public byte[] ReadBytes(int count)
Parameters
countintThe number of bytes to read.
Returns
- byte[]
The bytes read.
ReadSpan(int)
Reads a number of bytes as a read-only span without copying, and advances the position accordingly.
public ReadOnlySpan<byte> ReadSpan(int count)
Parameters
countintThe number of bytes to read.
Returns
- ReadOnlySpan<byte>
A span over the underlying buffer.
ReadUInt16BE()
Reads a big-endian 16-bit unsigned integer and advances the position by two.
public ushort ReadUInt16BE()
Returns
- ushort
The value read.
ReadUInt32BE()
Reads a big-endian 32-bit unsigned integer and advances the position by four.
public uint ReadUInt32BE()
Returns
- uint
The value read.