KS.Reactor.ksBitWriter Class Reference

Writes bit-packed data to a ksStreamBuffer. More...

Public Member Functions

 ksBitWriter (ksStreamBuffer buffer)
 Constructor More...
 
void WriteBits (uint input, int bits)
 Writes up to 32 bits into the buffer. More...
 
void WriteBits64 (ulong input, int bits)
 Writes up to 64 bits into the buffer. More...
 
void Write (bool value)
 Writes 1 bit to the buffer. More...
 
void Flush ()
 Flushes the current byte to the buffer. Subsequent writes will write to the next byte. More...
 

Detailed Description

Writes bit-packed data to a ksStreamBuffer.

When you are done writing all your data, you must call Flush to ensure the last byte of data is written. Read the data using a ksBitReader.

Constructor & Destructor Documentation

◆ ksBitWriter()

KS.Reactor.ksBitWriter.ksBitWriter ( ksStreamBuffer  buffer)

Constructor

Parameters
bufferBuffer to write to.

Member Function Documentation

◆ Flush()

void KS.Reactor.ksBitWriter.Flush ( )

Flushes the current byte to the buffer. Subsequent writes will write to the next byte.

◆ Write()

void KS.Reactor.ksBitWriter.Write ( bool  value)

Writes 1 bit to the buffer.

Parameters
valueValue to write. True = 1, False = 0.

◆ WriteBits()

void KS.Reactor.ksBitWriter.WriteBits ( uint  input,
int  bits 
)

Writes up to 32 bits into the buffer.

Parameters
inputinput to write bits from.
bitsnumber of bits from input to write.

◆ WriteBits64()

void KS.Reactor.ksBitWriter.WriteBits64 ( ulong  input,
int  bits 
)

Writes up to 64 bits into the buffer.

Parameters
inputinput to write bits from.
bitsnumber of bits from input to write.