Sese Framework
2.3.0
A cross-platform framework
|
Thread-safe byte buffer class. More...
#include <ByteBuffer.h>
Public Types | |
using | Ptr = std::unique_ptr<ByteBuffer> |
Public Member Functions | |
ByteBuffer (size_t base_size=STREAM_BYTE_STREAM_SIZE_FACTOR, size_t factor=STREAM_BYTE_STREAM_SIZE_FACTOR) | |
void | resetPos () override |
Reset the read position. | |
bool | eof () override |
Whether there is readable data. | |
size_t | getLength () |
size_t | getCapacity () |
size_t | freeCapacity () override |
int64_t | read (void *buffer, size_t len) override |
int64_t | write (const void *buffer, size_t len) override |
int64_t | peek (void *buffer, size_t len) override |
int64_t | trunc (size_t need_read) override |
Private Member Functions | |
virtual size_t | getCapacity () const |
virtual size_t | getLength () const |
Private Member Functions inherited from sese::io::AbstractByteBuffer | |
AbstractByteBuffer (size_t base_size=STREAM_BYTE_STREAM_SIZE_FACTOR, size_t factor=STREAM_BYTE_STREAM_SIZE_FACTOR) | |
AbstractByteBuffer (const AbstractByteBuffer &abstract_byte_buffer) noexcept | |
Copy. | |
AbstractByteBuffer (AbstractByteBuffer &&abstract_byte_buffer) noexcept | |
Mobile semantics. | |
~AbstractByteBuffer () override | |
virtual size_t | getReadableSize () const |
virtual void | swap (AbstractByteBuffer &other) noexcept |
Private Member Functions inherited from sese::io::InputStream | |
virtual | ~InputStream () noexcept=default |
Private Member Functions inherited from sese::io::OutputStream | |
virtual | ~OutputStream () noexcept=default |
int64_t | write (const std::string_view &buffer) |
int64_t | write (const text::StringView &buffer) |
template<typename T > | |
int64_t | write (std::vector< T > &buffer) |
template<typename T , size_t N> | |
int64_t | write (std::array< T, N > &buffer) |
Private Member Functions inherited from sese::io::PeekableStream | |
virtual | ~PeekableStream ()=default |
Private Attributes | |
std::mutex | mutex |
Additional Inherited Members | |
Private Types inherited from sese::io::Stream | |
typedef std::shared_ptr< Stream > | Ptr |
Private Types inherited from sese::io::InputStream | |
typedef std::shared_ptr< InputStream > | Ptr |
Private Types inherited from sese::io::OutputStream | |
typedef std::shared_ptr< OutputStream > | Ptr |
Private Types inherited from sese::io::PeekableStream | |
typedef std::shared_ptr< PeekableStream > | Ptr |
Thread-safe byte buffer class.
using sese::io::ByteBuffer::Ptr = std::unique_ptr<ByteBuffer> |
|
explicit |
|
overridevirtual |
Whether there is readable data.
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::eof().
|
overridevirtual |
Release all nodes before CurrentReadNode
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::freeCapacity().
|
nodiscard |
References sese::io::AbstractByteBuffer::getCapacity().
|
nodiscardprivatevirtual |
Reimplemented from sese::io::AbstractByteBuffer.
|
nodiscard |
References sese::io::AbstractByteBuffer::getLength().
|
nodiscardprivatevirtual |
Reimplemented from sese::io::AbstractByteBuffer.
|
overridevirtual |
Read content without stepping
buffer | Buffer |
length | Buffer size |
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::peek().
|
overridevirtual |
Reimplemented from sese::io::AbstractByteBuffer.
References mutex, and sese::io::AbstractByteBuffer::read().
|
overridevirtual |
Reset the read position.
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::resetPos().
|
overridevirtual |
Step only, without reading content
length | Step size |
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::trunc().
|
overridevirtual |
Reimplemented from sese::io::AbstractByteBuffer.
References sese::io::AbstractByteBuffer::write().
|
private |
Referenced by read().