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

#include <NetBitStreamWriter.h>

Public Member Functions

IRISCORE_API FNetBitStreamWriter ()
 
IRISCORE_API ~FNetBitStreamWriter ()
 
IRISCORE_API void InitBytes (void *Buffer, uint32 ByteCount)
 
IRISCORE_API void WriteBits (uint32 Value, uint32 BitCount)
 
bool WriteBool (bool Value)
 
IRISCORE_API void WriteBitStream (const uint32 *Src, uint32 SrcBitOffset, uint32 BitCount)
 
IRISCORE_API void CommitWrites ()
 
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 FNetBitStreamWriter CreateSubstream (uint32 MaxBitCount=~0U)
 
IRISCORE_API void CommitSubstream (FNetBitStreamWriter &Substream)
 
IRISCORE_API void DiscardSubstream (FNetBitStreamWriter &Substream)
 

Constructor & Destructor Documentation

◆ FNetBitStreamWriter()

UE::Net::FNetBitStreamWriter::FNetBitStreamWriter ( )

◆ ~FNetBitStreamWriter()

UE::Net::FNetBitStreamWriter::~FNetBitStreamWriter ( )

Member Function Documentation

◆ CommitSubstream()

void UE::Net::FNetBitStreamWriter::CommitSubstream ( FNetBitStreamWriter 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. CommitWrites() is not called by this method.

◆ CommitWrites()

void UE::Net::FNetBitStreamWriter::CommitWrites ( )

Commits pending writes to the buffer. Before this call, or the destruction of this instance, the buffer may not be up to date. Typically called after all WriteBits() calls have been made.

◆ CreateSubstream()

FNetBitStreamWriter UE::Net::FNetBitStreamWriter::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 writes may be performed to this stream until the substream has been committed or discarded. Any write to a substream that occurs before overflow can modify the stream buffer contents regardless of whether the stream is committed or discarded.

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

Parameters
MaxBitCountThe maximum allowed bits that may be written. The value will be clamped to the number of bits left in this stream/substream.
Returns
A BitStreamWriter that can be written to just like a regular BitStreamWriter.

◆ DiscardSubstream()

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

Discards a substream of this stream. This stream's bit position will remain intact. The buffer may be modified anyway as mentioned in CreateSubStream().

◆ DoOverflow()

void UE::Net::FNetBitStreamWriter::DoOverflow ( )

Force an overflow.

◆ GetAbsolutePosBits()

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

Returns the absolute bit position

◆ GetBitsLeft()

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

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

◆ GetPosBits()

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

Returns the current bit position

◆ GetPosBytes()

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

Returns the the current byte position.

◆ InitBytes()

void UE::Net::FNetBitStreamWriter::InitBytes ( void Buffer,
uint32  ByteCount 
)

InitBytes must be called before writing to the stream.

Parameters
BufferThe buffer must be at least 4-byte aligned.
ByteCountThe number of bytes that is allowed to be written. Must be a multiple of 4.

◆ IsOverflown()

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

Returns whether the stream is overflown or not.

◆ Seek()

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

Seek to a specific BitPosition. If the stream is overflown and you seek back to a position where you can still write bits the stream will no longer be considered overflown.

◆ WriteBits()

void UE::Net::FNetBitStreamWriter::WriteBits ( uint32  Value,
uint32  BitCount 
)

Writes the BitCount least significant bits from Value. There's no validation of the Value, meaning it is allowed to contain garbage in the bits that are not going to be written to the buffer. If the BitCount exceeds the remaining space no bits will be written and the stream will be marked as overflown.

◆ WriteBitStream()

void UE::Net::FNetBitStreamWriter::WriteBitStream ( const uint32 Src,
uint32  SrcBitOffset,
uint32  BitCount 
)

Writes BitCount bits from Src starting at SrcBitOffset. Assumes that Src was written to via this class or that bits were written in order from lowest to highest memory address. If the BitCount exceeds the remaining space no bits will be written and the stream will be marked as overflown.

◆ WriteBool()

bool UE::Net::FNetBitStreamWriter::WriteBool ( bool  Value)
inline

Writes a bool to the stream and returns the value of the bool


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