docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct BitReader

    Helper class for doing bitwise reads for a FastBufferReader. Ensures all bitwise reads end on proper byte alignment so FastBufferReader doesn't have to be concerned with misaligned reads.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Netcode
    Assembly: solution.dll
    Syntax
    public ref struct BitReader

    Properties

    Name Description
    BitAligned

    Whether or not the current BitPosition is evenly divisible by 8. I.e. whether or not the BitPosition is at a byte boundary.

    Methods

    Name Description
    Dispose()

    Pads the read bit count to byte alignment and commits the read back to the reader

    ReadBit(out bool)

    Read a single bit from the buffer

    ReadBits(out byte, uint)

    Read bits from stream.

    ReadBits(out ulong, uint)

    Read a certain amount of bits from the stream.

    TryBeginReadBits(uint)

    Verifies the requested bit count can be read from the buffer. This exists as a separate method to allow multiple bit reads to be bounds checked with a single call. If it returns false, you may not read, and in editor and development builds, attempting to do so will throw an exception. In release builds, attempting to do so will read junk memory.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)