FIFO of bytes. More...
#include <CStreamBuffer.h>
Public Member Functions | |
manipulators | |
const void * | peek (UInt32 n) |
Read data without removing from buffer. | |
void | pop (UInt32 n) |
Discard data. | |
void | write (const void *data, UInt32 n) |
Write data to buffer. | |
accessors | |
UInt32 | getSize () const |
Get size of buffer. |
FIFO of bytes.
This class maintains a FIFO (first-in, last-out) buffer of bytes.
Definition at line 26 of file CStreamBuffer.h.
UInt32 CStreamBuffer::getSize | ( | ) | const |
Get size of buffer.
Returns the number of bytes in the buffer.
Definition at line 139 of file CStreamBuffer.cpp.
Referenced by CPacketStreamFilter::close(), CTCPSocket::getSize(), CTCPSocket::isReady(), CTCPSocket::read(), CPacketStreamFilter::shutdownInput(), and CTCPSocket::write().
const void * CStreamBuffer::peek | ( | UInt32 | n | ) |
Read data without removing from buffer.
Return a pointer to memory with the next n
bytes in the buffer (which must be <= getSize()). The caller must not modify the returned memory nor delete it.
Definition at line 36 of file CStreamBuffer.cpp.
Referenced by CTCPSocket::read(), and CPacketStreamFilter::read().
void CStreamBuffer::pop | ( | UInt32 | n | ) |
Discard data.
Discards the next n
bytes. If n
>= getSize() then the buffer is cleared.
Definition at line 62 of file CStreamBuffer.cpp.
Referenced by CPacketStreamFilter::close(), CTCPSocket::read(), CPacketStreamFilter::read(), and CPacketStreamFilter::shutdownInput().
void CStreamBuffer::write | ( | const void * | data, | |
UInt32 | n | |||
) |
Write data to buffer.
Appends n
bytes from data
to the buffer.
Definition at line 92 of file CStreamBuffer.cpp.
Referenced by CTCPSocket::write().