Public Member Functions | |
| ByteBuffer (uint32_t size=0) | |
| Create a byte buffer of the given size. More... | |
| ~ByteBuffer () | |
| Delete this byte buffer. More... | |
| void | resize (uint32_t size) |
| Set the size of the buffer. More... | |
| void | push (uint8_t data) |
| Add a single byte to this buffer. More... | |
| void | write (uint8_t *data, uint32_t size) |
| Write a block of data to this ByteBuffer. More... | |
| uint8_t | pop () |
| Remove a byte from this buffer. More... | |
| void | read (uint8_t *data, uint32_t size) |
| Read a block of data from this ByteBuffer into a buffer pointed by 'data'. More... | |
| uint32_t | size () |
| Return the number bytes in this byte buffer. More... | |
| uint32_t | free () |
| Return the number of additional bytes this buffer can hold. More... | |
| bool | full () |
| Check if this byte buffer is full. More... | |
| bool | empty () |
| Check if this byte buffer is empty. More... | |
Definition at line 23 of file ByteBuffer.h.
| ByteBuffer | ( | uint32_t | size = 0 | ) |
Create a byte buffer of the given size.
| size | Number of bytes this buffer can hold |
| ~ByteBuffer | ( | ) |
Delete this byte buffer.
| bool empty | ( | ) |
Check if this byte buffer is empty.
| uint32_t free | ( | ) |
Return the number of additional bytes this buffer can hold.
| bool full | ( | ) |
Check if this byte buffer is full.
| uint8_t pop | ( | ) |
Remove a byte from this buffer.
| void push | ( | uint8_t | data | ) |
Add a single byte to this buffer.
There must be enough space in the buffer or the behavior is undefined.
| data | byte to add |
| void read | ( | uint8_t * | data, |
| uint32_t | size | ||
| ) |
Read a block of data from this ByteBuffer into a buffer pointed by 'data'.
There must be enough data in the ByteBuffer or the behavior is undefined.
| data | Block of data to read |
| size | Size of data to read |
| void resize | ( | uint32_t | size | ) |
Set the size of the buffer.
Buffer contents are reset.
| size | New buffer size |
| uint32_t size | ( | ) |
Return the number bytes in this byte buffer.
| void write | ( | uint8_t * | data, |
| uint32_t | size | ||
| ) |
Write a block of data to this ByteBuffer.
There must be enough space in the ByteBuffer or the behavior is undefined.
| data | Block of data to write |
| size | Size of data to write |