Stream buffer class.
More...
#include <BufferedStream.h>
|
Stream::Ptr | source |
| Source stream pointer.
|
|
void * | buffer = nullptr |
| Cache pointer.
|
|
size_t | pos |
| Size of processed data.
|
|
size_t | len |
| Size of data available for operation.
|
|
size_t | cap |
| Cache capacity.
|
|
◆ Ptr
◆ BufferedStream()
◆ ~BufferedStream()
BufferedStream::~BufferedStream |
( |
| ) |
|
|
overridenoexcept |
◆ clear()
void BufferedStream::clear |
( |
| ) |
|
|
noexcept |
Clear the current read flag.
- Warning
- Ensure that all content in BufferedStream has been read out before performing this operation, otherwise it may result in the loss of necessary information
References len, and pos.
◆ flush()
int64_t BufferedStream::flush |
( |
| ) |
|
|
noexcept |
Flush all current buffer contents to the stream and reset the current write flag.
- Returns
- Number of bytes flushed to the stream
References buffer, len, pos, and source.
Referenced by write().
◆ getCapacity()
size_t sese::io::BufferedStream::getCapacity |
( |
| ) |
const |
|
inlinenodiscard |
◆ getLength()
size_t sese::io::BufferedStream::getLength |
( |
| ) |
const |
|
inlinenodiscard |
◆ getPosition()
size_t sese::io::BufferedStream::getPosition |
( |
| ) |
const |
|
inlinenodiscard |
◆ preRead()
int64_t BufferedStream::preRead |
( |
| ) |
|
|
inlineprivate |
◆ read()
int64_t BufferedStream::read |
( |
void * | buffer, |
|
|
size_t | length ) |
|
overridevirtual |
* Read a certain number of bytes
* If the read size does not exceed the BufferedStream buffer size, the read will be automatically cached
* Otherwise, direct raw stream reading is performed to reduce copy operations
*
- Parameters
-
buffer | User buffer pointer |
length | User buffer size |
- Returns
- Actual number of bytes read
Implements sese::io::InputStream.
References buffer, cap, len, pos, preRead(), read(), and source.
Referenced by preRead(), and read().
◆ reset()
void BufferedStream::reset |
( |
const Stream::Ptr & | source | ) |
|
|
noexcept |
Reset output source; this will cause existing data to be cleared
- Parameters
-
◆ write()
int64_t BufferedStream::write |
( |
const void * | buffer, |
|
|
size_t | length ) |
|
overridevirtual |
* Write a certain number of bytes
* If the write size does not exceed the BufferedStream buffer size, the write will be automatically flushed
* Otherwise, direct raw stream writing is performed to reduce copy operations
*
- Parameters
-
buffer | User buffer pointer |
length | User buffer size |
- Returns
- Actual number of bytes written
Implements sese::io::OutputStream.
References buffer, cap, flush(), len, pos, and source.
◆ buffer
void* sese::io::BufferedStream::buffer = nullptr |
|
private |
◆ cap
size_t sese::io::BufferedStream::cap |
|
private |
◆ len
size_t sese::io::BufferedStream::len |
|
private |
◆ pos
size_t sese::io::BufferedStream::pos |
|
private |
◆ source
The documentation for this class was generated from the following files: