Skip to content
Tomáš Malý edited this page Aug 6, 2020 · 4 revisions

Buffer

Buffer is a convenient unstructured memory buffer wrapper with automatic deallocation.

Its method Buffer::allocate allocates a buffer of the specified size. Any previous data are lost. The memory is not initialized. Method Buffer::free releases the buffer.

Method Buffer::data is used to access the raw memory. Its size is given by Buffer::size.

The buffer cannot be implicitly copied. Instead, one has to use method Copy. The buffer is movable.

Functions writeLocalFileBuffer and readLocalFileBuffer provide fast way to read or write whole file to or from a buffer. Function readInternalMemoryBuffer allows to read some data which were compiled into the library.

Class detail::Wrapper may be used to read data from the buffer as if it was a standard stream.