Table of Contents

BiffRecordHeader Struct

Definition

Namespace
Bodu.IO.Biff
Assembly
Bodu.IO.Biff.dll
Package
Bodu.IO.Biff 1.0.0
Source
BiffRecordHeader.cs

Represents the four-byte header that precedes every BIFF record: a 16-bit little-endian record identifier followed by the 16-bit little-endian length of the payload that follows.

public readonly struct BiffRecordHeader : IEquatable<BiffRecordHeader>
Implements
Inherited Members
Extension Methods

Remarks

BiffReader parses a header for every record it frames and exposes the current one as Header; the type is public so a caller framing records itself - a stream scanner skipping payloads, for example - shares the same layout. Length is the declared payload length, which a conformant writer keeps within GetMaxPayloadLength(BiffVersion).

Constructors

BiffRecordHeader(ushort, ushort)

Represents the four-byte header that precedes every BIFF record: a 16-bit little-endian record identifier followed by the 16-bit little-endian length of the payload that follows.

public BiffRecordHeader(ushort Id, ushort Length)

Parameters

Id ushort

The 16-bit record identifier.

Length ushort

The declared payload length, in bytes.

Remarks

BiffReader parses a header for every record it frames and exposes the current one as Header; the type is public so a caller framing records itself - a stream scanner skipping payloads, for example - shares the same layout. Length is the declared payload length, which a conformant writer keeps within GetMaxPayloadLength(BiffVersion).

See Also

Properties

Id

The 16-bit record identifier.

public ushort Id { get; init; }

Property Value

ushort

Length

The declared payload length, in bytes.

public ushort Length { get; init; }

Property Value

ushort

Type

Gets the record identifier as a BiffRecordType.

public BiffRecordType Type { get; }

Property Value

BiffRecordType

The typed identifier. The value may not correspond to a defined member when the record is one the codec does not name.

Methods

Deconstruct(out ushort, out ushort)

public void Deconstruct(out ushort Id, out ushort Length)

Parameters

Id ushort
Length ushort

Equals(BiffRecordHeader)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(BiffRecordHeader other)

Parameters

other BiffRecordHeader

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

TryParse(ReadOnlySpan<byte>, out BiffRecordHeader)

Attempts to parse a record header from the start of the supplied bytes.

public static bool TryParse(ReadOnlySpan<byte> source, out BiffRecordHeader header)

Parameters

source ReadOnlySpan<byte>

The bytes to parse.

header BiffRecordHeader

When this method returns, the parsed header when one was available.

Returns

bool

true when source holds at least RecordHeaderSize bytes; otherwise false.

WriteTo(Span<byte>)

Writes the header to the start of the supplied buffer.

public void WriteTo(Span<byte> destination)

Parameters

destination Span<byte>

The buffer that receives the four header bytes.

Exceptions

ArgumentException

Thrown when destination is shorter than RecordHeaderSize.

Operators

operator ==(BiffRecordHeader, BiffRecordHeader)

public static bool operator ==(BiffRecordHeader left, BiffRecordHeader right)

Parameters

left BiffRecordHeader
right BiffRecordHeader

Returns

bool

operator !=(BiffRecordHeader, BiffRecordHeader)

public static bool operator !=(BiffRecordHeader left, BiffRecordHeader right)

Parameters

left BiffRecordHeader
right BiffRecordHeader

Returns

bool

Applies to

ProductVersions
.NET8, 10

See Also