UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Net::FNetBitStreamReader Class Reference

#include <NetBitStreamReader.h>

Public Member Functions

IRISCORE_API FNetBitStreamReader ()
 
IRISCORE_API ~FNetBitStreamReader ()
 
IRISCORE_API void InitBits (const void *Buffer, uint32 BitCount)
 
IRISCORE_API uint32 ReadBits (uint32 BitCount)
 
bool ReadBool ()
 
IRISCORE_API void ReadBitStream (uint32 *Dst, uint32 BitCount)
 
IRISCORE_API void Seek (uint32 BitPosition)
 
uint32 GetPosBytes () const
 
uint32 GetPosBits () const
 
uint32 GetAbsolutePosBits () const
 
uint32 GetBitsLeft () const
 
IRISCORE_API void DoOverflow ()
 
bool IsOverflown () const
 
IRISCORE_API FNetBitStreamReader CreateSubstream (uint32 MaxBitCount=~0U)
 
IRISCORE_API void CommitSubstream (FNetBitStreamReader &Substream)
 
IRISCORE_API void DiscardSubstream (FNetBitStreamReader &Substream)
 

Constructor & Destructor Documentation

◆ FNetBitStreamReader()

UE::Net::FNetBitStreamReader::FNetBitStreamReader ( )

◆ ~FNetBitStreamReader()

UE::Net::FNetBitStreamReader::~FNetBitStreamReader ( )

Member Function Documentation

◆ CommitSubstream()

void UE::Net::FNetBitStreamReader::CommitSubstream ( FNetBitStreamReader Substream)

Commits a substream to this stream. Substreams that are overflown or do not belong to this stream will be ignored. If the substream is valid then this stream's bit position will be updated.

◆ CreateSubstream()

FNetBitStreamReader UE::Net::FNetBitStreamReader::CreateSubstream ( uint32  MaxBitCount = ~0U)

Creates a substream at the current bit position. The substream must be committed or discarded. Only one active substream at a time is allowed, but a substream can have an active substream as well. Once the substream has been commited or discarded a new substream may be created. No reads may be performed on this stream until the substream has been committed or discarded.

The returned FNetBitStreamReader will have similar behavior to a newly constructed regular FNetBitStreamWriter.

Parameters
MaxBitCountThe maximum allowed bits that may be read. The value will be clamped to the number of bits left in this stream/substream. If it's a requirement a specific size is supported you can verify it with GetBitsLeft().
Returns
A FNetBitStreamReader.

◆ DiscardSubstream()

void UE::Net::FNetBitStreamReader::DiscardSubstream ( FNetBitStreamReader Substream)

Discards a substream of this stream. This stream's bit position will remain intact.

◆ DoOverflow()

void UE::Net::FNetBitStreamReader::DoOverflow ( )

Force an overflow.

◆ GetAbsolutePosBits()

uint32 UE::Net::FNetBitStreamReader::GetAbsolutePosBits ( ) const
inline

Returns the absolute bit position

◆ GetBitsLeft()

uint32 UE::Net::FNetBitStreamReader::GetBitsLeft ( ) const
inline

Returns the number of bits that can be read before overflowing.

◆ GetPosBits()

uint32 UE::Net::FNetBitStreamReader::GetPosBits ( ) const
inline

Returns the current bit position

◆ GetPosBytes()

uint32 UE::Net::FNetBitStreamReader::GetPosBytes ( ) const
inline

Returns the the current byte position.

◆ InitBits()

void UE::Net::FNetBitStreamReader::InitBits ( const void Buffer,
uint32  BitCount 
)

InitBits must be called before reading from the stream.

Parameters
BufferThe buffer must be at least 4-byte aligned.
BitCountThe number of bits that is allowed to be read from the buffer.

◆ IsOverflown()

bool UE::Net::FNetBitStreamReader::IsOverflown ( ) const
inline

Returns whether the stream is overflown or not.

◆ ReadBits()

uint32 UE::Net::FNetBitStreamReader::ReadBits ( uint32  BitCount)

Reads BitCount bits that are stored in the least significant bits in the return value. Other bits will be set to zero. If the BitCount exceeds the remaining space the function will return zero and the stream will be marked as overflown.

◆ ReadBitStream()

void UE::Net::FNetBitStreamReader::ReadBitStream ( uint32 Dst,
uint32  BitCount 
)

Reads BitCount bits and stores them in Dst, starting from bit offset 0. The bits will be stored as they are stored internally in this class, i.e. bits will be written from lower to higher memory addresses. If the BitCount exceeds the remaining space no bits will be written to Dst and the stream will be marked as overflown. It's up to the user to check for overflow.

◆ ReadBool()

bool UE::Net::FNetBitStreamReader::ReadBool ( )
inline

Reads a bool from the stream and returns the value, A failed read will always return false and stream will be marked as overflown

◆ Seek()

void UE::Net::FNetBitStreamReader::Seek ( uint32  BitPosition)

Seek to a specific position from the start of the stream or substream. If the stream is overflown and you seek back to a position where you can still read bits the stream will no longer be considered overflown.


The documentation for this class was generated from the following files: