Vixen
02b45cc4
csharp
public ref struct BitReader

Reads what BitWriter wrote, and refuses to be surprised by it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The same contract PacketReader keeps, for the same reasons: nothing throws on the contents of a packet, every read returns a Boolean, and the first failure is sticky so a decoder can read a whole message and check once at the end.

Fields and properties (3)

  • public bool Failed

    Whether any read has failed. Once set, every later read fails too.

  • public readonly int BitsRead

    How many bits have been read.

  • public readonly int BitsRemaining

    How many bits are left.

Methods (13)

  • public BitReader(ReadOnlySpan<byte> buffer)

    Creates a reader over a packet.

  • public bool TryRead(int count, out uint value)

    Reads a field of a given width.

  • public bool TryReadBool(out bool value)

    Reads one bit.

  • public bool TryReadUInt32(out uint value)

    Reads a whole 32-bit value.

  • public bool TryReadInt32(out int value)

    Reads a whole 32-bit signed value.

  • public bool TryReadSingle(out float value)

    Reads a float written by its bits.

  • public bool TryReadQuantized(in QuantizeRange range, out float value)

    Reads a float that was quantized into a range.

  • public bool TryReadVariable(out uint value)

    Reads a value written by WriteVariable.

  • public void Rewind(int bitPosition)

    Puts the reader back to an earlier position, to read the same bits again.

  • public bool TryReadBitsOver(int count)

    Steps over bits without looking at them.

  • public bool TryCopyTo(ref BitWriter destination, int count)

    Copies bits out of this reader into a writer, unchanged.

  • public bool Align()

    Moves to the next byte boundary, matching Align.

  • public bool TryReadBytes(int count, out ReadOnlySpan<byte> bytes)

    Reads bytes, aligning first.

Used by (78, showing 40)

  • AvatarControllerMultiplayer
  • Vixen_Samples_Multiplayer_CombatantReplicatorMultiplayer
  • Vixen_Samples_Multiplayer_VitalsReplicatorMultiplayer
  • AnsweringVixen.Net.Tests
  • AwaitableRpcTestsVixen.Net.Tests
  • BitCodecTestsVixen.Net.Tests
  • BitExactnessTestsVixen.Net.Tests
  • BitReaderTargetVixen.Net.Fuzz
  • BitWriterVixen.Net
  • BoolCodecVixen.Net.Engine
  • BroadcastRouterVixen.Net
  • ByteCodecVixen.Net.Engine
  • ChatVixen.Net.Tests
  • ClientPredictionTestsVixen.Net.Tests
  • CountdownVixen.Net.Tests
  • CounterVixen.Net.Tests
  • CountingInvokerVixen.Net.Fuzz
  • DeltaCodecVixen.Net
  • DeltaCodecTargetVixen.Net.Fuzz
  • DeltaTestsVixen.Net.Tests
  • FuzzInputVixen.Net.Fuzz
  • GeneratedTurretVixen.Net.Generators.Tests
  • HandWrittenTransformReplicatorVixen.Net.Generators.Tests
  • HealthReplicatorVixen.Net.Tests
  • IBroadcastVixen.Net
  • IComponentReplicatorVixen.Net
  • IPredictedInputVixen.Net
  • IRpcInvokerVixen.Net
  • ISyncCodecVixen.Net.Engine
  • ISyncFieldVixen.Net.Engine
  • ISyncListVixen.Net.Engine
  • InputBufferVixen.Net
  • Int32CodecVixen.Net.Engine
  • MathCodecVixen.Net
  • MotionTestsVixen.Net.Tests
  • MoveVixen.Net.Tests
  • MoveVixen.Net.Tests
  • NetworkAnimatorParametersReplicatorVixen.Net.Animation
  • NetworkAnimatorReplicatorVixen.Net.Animation
  • NetworkAnimatorTestsVixen.Net.Animation.Tests