Base module

DynamicBitWriter

Class for reading/writing dynamically resizable binary streams.

DynamicBitWriter

#include <icy/buffer.h>

Inherits: BitWriter

Class for reading/writing dynamically resizable binary streams.

Note that when using the constructor with the Buffer reference as an argument, the writer will dynamically expand the given buffer when writing passed the buffer capacity. All other cases will throw a std::out_of_range error when writing past the buffer capacity.

Public Methods

ReturnNameDescription
DynamicBitWriterConstructs a [DynamicBitWriter](#dynamicbitwriter) backed by a dynamically resizable Buffer. The buffer is expanded automatically as data is written.
DynamicBitWriterConstructs a [DynamicBitWriter](#dynamicbitwriter) that inserts data starting at a specific iterator position.
voidput virtualAppend bytes to the buffer. Throws a std::out_of_range exception if reading past the limit.
boolupdate virtualUpdate a byte range. Throws a std::out_of_range exception if reading past the limit.

DynamicBitWriter

DynamicBitWriter(Buffer & buf, ByteOrder order)

Constructs a [DynamicBitWriter](#dynamicbitwriter) backed by a dynamically resizable Buffer. The buffer is expanded automatically as data is written.

Parameters

  • buf Buffer to write into; expanded as needed.

  • order Byte order used for multi-byte integer writes.


DynamicBitWriter

DynamicBitWriter(Buffer & buf, Buffer::iterator offset, ByteOrder order)

Constructs a [DynamicBitWriter](#dynamicbitwriter) that inserts data starting at a specific iterator position.

Parameters

  • buf Buffer to write into; expanded as needed.

  • offset Iterator into buf indicating the insertion start point.

  • order Byte order used for multi-byte integer writes.


put

virtual

virtual void put(const char * val, size_t len)

Append bytes to the buffer. Throws a std::out_of_range exception if reading past the limit.


update

virtual

virtual bool update(const char * val, size_t len, size_t pos)

Update a byte range. Throws a std::out_of_range exception if reading past the limit.

Protected Attributes

ReturnNameDescription
Buffer &_buffer
size_t_offset

_buffer

Buffer & _buffer

_offset

size_t _offset