DynamicBitWriter
DynamicBitWriter
#include <icy/buffer.h>class DynamicBitWriterDefined in src/base/include/icy/buffer.h:596
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
DynamicBitWriter | function | Declared here |
DynamicBitWriter | function | Declared here |
~DynamicBitWriter | function | Declared here |
put | function | Declared here |
update | function | Declared here |
_buffer | variable | Declared here |
_offset | variable | Declared here |
operator<< | friend | Inherited from BitWriter |
BitWriter | function | Inherited from BitWriter |
BitWriter | function | Inherited from BitWriter |
BitWriter | function | Inherited from BitWriter |
~BitWriter | function | Inherited from BitWriter |
put | function | Inherited from BitWriter |
put | function | Inherited from BitWriter |
putU8 | function | Inherited from BitWriter |
putU16 | function | Inherited from BitWriter |
putU24 | function | Inherited from BitWriter |
putU32 | function | Inherited from BitWriter |
putU64 | function | Inherited from BitWriter |
update | function | Inherited from BitWriter |
update | function | Inherited from BitWriter |
updateU8 | function | Inherited from BitWriter |
updateU16 | function | Inherited from BitWriter |
updateU24 | function | Inherited from BitWriter |
updateU32 | function | Inherited from BitWriter |
updateU64 | function | Inherited from BitWriter |
seek | function | Inherited from BitWriter |
skip | function | Inherited from BitWriter |
limit | function | Inherited from BitWriter |
position | function | Inherited from BitWriter |
available | function | Inherited from BitWriter |
begin | function | Inherited from BitWriter |
current | function | Inherited from BitWriter |
begin | function | Inherited from BitWriter |
current | function | Inherited from BitWriter |
order | function | Inherited from BitWriter |
toString | function | Inherited from BitWriter |
_position | variable | Inherited from BitWriter |
_limit | variable | Inherited from BitWriter |
_order | variable | Inherited from BitWriter |
_bytes | variable | Inherited from BitWriter |
init | function | Inherited from BitWriter |
Inherited from BitWriter
| Kind | Name | Description |
|---|---|---|
friend | operator<< inline | |
function | BitWriter | Constructs a [BitWriter](icy-BitWriter.html#bitwriter) over a raw byte array with a fixed capacity. |
function | BitWriter | Constructs a [BitWriter](icy-BitWriter.html#bitwriter) backed by a Buffer. Writes are bounded by the buffer's capacity; use [DynamicBitWriter](#dynamicbitwriter) for auto-resize. |
function | BitWriter | Constructs a [BitWriter](icy-BitWriter.html#bitwriter) over a [MutableBuffer](icy-MutableBuffer.html#mutablebuffer-6) with a fixed capacity. |
function | ~BitWriter virtual | |
function | put virtual | Append bytes to the buffer. Throws a std::out_of_range exception if reading past the limit. |
function | put | Appends the contents of a string. Throws std::out_of_range if capacity is exceeded. |
function | putU8 | Appends an unsigned 8-bit integer. Throws std::out_of_range if capacity is exceeded. |
function | putU16 | Appends an unsigned 16-bit integer with byte-order conversion. Throws std::out_of_range if capacity is exceeded. |
function | putU24 | Appends the low 24 bits of a 32-bit integer with byte-order conversion. Throws std::out_of_range if capacity is exceeded. |
function | putU32 | Appends an unsigned 32-bit integer with byte-order conversion. Throws std::out_of_range if capacity is exceeded. |
function | putU64 | Appends an unsigned 64-bit integer with byte-order conversion. Throws std::out_of_range if capacity is exceeded. |
function | update virtual | Update a byte range. Throws a std::out_of_range exception if reading past the limit. |
function | update | Overwrites a previously written string at the given absolute position. |
function | updateU8 | Overwrites a uint8_t at the given absolute position. |
function | updateU16 | Overwrites a uint16_t at the given absolute position, with byte-order conversion. |
function | updateU24 | Overwrites 3 bytes (low 24 bits of val) at the given absolute position, with byte-order conversion. |
function | updateU32 | Overwrites a uint32_t at the given absolute position, with byte-order conversion. |
function | updateU64 | Overwrites a uint64_t at the given absolute position, with byte-order conversion. |
function | seek | Set position pointer to absolute position. Throws a std::out_of_range exception if the value exceeds the limit. |
function | skip | Set position pointer to relative position. Throws a std::out_of_range exception if the value exceeds the limit. |
function | limit const | Returns the write limit. |
function | position const inline | Returns the current write position. |
function | available const | Returns the number of elements between the current write position and the limit. |
function | begin inline | Returns a pointer to the start of the write buffer. |
function | current inline | Returns a pointer to the current write position. |
function | begin const inline | Returns a const pointer to the start of the write buffer. |
function | current const inline | Returns a const pointer to the current write position. |
function | order const inline | Returns the byte order used for multi-byte integer writes. |
function | toString | Returns all bytes written so far as a std::string. |
variable | _position | |
variable | _limit | |
variable | _order | |
variable | _bytes | |
function | init virtual |
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 override | Append bytes to the buffer. Throws a std::out_of_range exception if reading past the limit. |
bool | update virtual override | Update a byte range. Throws a std::out_of_range exception if reading past the limit. |
DynamicBitWriter
DynamicBitWriter(Buffer & buf, ByteOrder order = ByteOrder::Network)Defined in src/base/include/icy/buffer.h:603
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 = ByteOrder::Network)Defined in src/base/include/icy/buffer.h:609
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 override
virtual void put(const char * val, size_t len) overrideDefined in src/base/include/icy/buffer.h:614
Append bytes to the buffer. Throws a std::out_of_range exception if reading past the limit.
Reimplements
update
virtual override
virtual bool update(const char * val, size_t len, size_t pos) overrideDefined in src/base/include/icy/buffer.h:618
Update a byte range. Throws a std::out_of_range exception if reading past the limit.
Reimplements
Protected Attributes
_buffer
Buffer & _bufferDefined in src/base/include/icy/buffer.h:621
_offset
size_t _offset