DynamicBitWriter
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
| Return | Name | Description |
|---|---|---|
DynamicBitWriter | Constructs a [DynamicBitWriter](#dynamicbitwriter) backed by a dynamically resizable Buffer. The buffer is expanded automatically as data is written. | |
DynamicBitWriter | Constructs a [DynamicBitWriter](#dynamicbitwriter) that inserts data starting at a specific iterator position. | |
void | put virtual | Append bytes to the buffer. Throws a std::out_of_range exception if reading past the limit. |
bool | update virtual | Update 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
bufBuffer to write into; expanded as needed.orderByte 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
bufBuffer to write into; expanded as needed.offsetIterator intobufindicating the insertion start point.orderByte 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
_buffer
Buffer & _buffer_offset
size_t _offset