Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::io::ByteBuffer类 参考final

线程安全的字节缓冲类 更多...

#include <ByteBuffer.h>

类 sese::io::ByteBuffer 继承关系图:
sese::io::AbstractByteBuffer

Public 类型

using Ptr = std::unique_ptr<ByteBuffer>
 

Public 成员函数

 ByteBuffer (size_t base_size=STREAM_BYTE_STREAM_SIZE_FACTOR, size_t factor=STREAM_BYTE_STREAM_SIZE_FACTOR)
 
void resetPos () override
 重置读取位置
 
bool eof () override
 是否有可读数据
 
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 成员函数

virtual size_t getCapacity () const
 
virtual size_t getLength () const
 
- Private 成员函数 继承自 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
 拷贝
 
 AbstractByteBuffer (AbstractByteBuffer &&abstract_byte_buffer) noexcept
 移动语义
 
 ~AbstractByteBuffer () override
 析构
 
virtual size_t getReadableSize () const
 
virtual void swap (AbstractByteBuffer &other) noexcept
 
- Private 成员函数 继承自 sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Private 成员函数 继承自 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 成员函数 继承自 sese::io::PeekableStream
virtual ~PeekableStream ()=default
 

Private 属性

std::mutex mutex
 

额外继承的成员函数

- Private 类型 继承自 sese::io::Stream
typedef std::shared_ptr< StreamPtr
 
- Private 类型 继承自 sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Private 类型 继承自 sese::io::OutputStream
typedef std::shared_ptr< OutputStreamPtr
 
- Private 类型 继承自 sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 

详细描述

线程安全的字节缓冲类

成员类型定义说明

◆ Ptr

using sese::io::ByteBuffer::Ptr = std::unique_ptr<ByteBuffer>

构造及析构函数说明

◆ ByteBuffer()

sese::io::ByteBuffer::ByteBuffer ( size_t base_size = STREAM_BYTE_STREAM_SIZE_FACTOR,
size_t factor = STREAM_BYTE_STREAM_SIZE_FACTOR )
explicit

成员函数说明

◆ eof()

bool sese::io::ByteBuffer::eof ( )
overridevirtual

是否有可读数据

重载 sese::io::AbstractByteBuffer .

引用了 sese::io::AbstractByteBuffer::eof().

◆ freeCapacity()

size_t sese::io::ByteBuffer::freeCapacity ( )
overridevirtual

释放 CurrentReadNode 前的所有节点

返回
实际释放空间,单位 “字节”

重载 sese::io::AbstractByteBuffer .

引用了 sese::io::AbstractByteBuffer::freeCapacity().

◆ getCapacity() [1/2]

size_t sese::io::ByteBuffer::getCapacity ( )
nodiscard

◆ getCapacity() [2/2]

size_t sese::io::AbstractByteBuffer::getCapacity ( ) const
nodiscardprivatevirtual
返回
所有节点容量总数

重载 sese::io::AbstractByteBuffer .

◆ getLength() [1/2]

size_t sese::io::ByteBuffer::getLength ( )
nodiscard

◆ getLength() [2/2]

size_t sese::io::AbstractByteBuffer::getLength ( ) const
nodiscardprivatevirtual
返回
所有节点已用内存总数

重载 sese::io::AbstractByteBuffer .

引用了 sese::io::AbstractByteBuffer::currentWriteNode.

◆ peek()

int64_t sese::io::ByteBuffer::peek ( void * buffer,
size_t length )
overridevirtual

仅读取内容,不步进

参数
buffer缓存
length缓存大小
返回
实际读取大小

重载 sese::io::AbstractByteBuffer .

引用了 sese::io::AbstractByteBuffer::peek().

◆ read()

int64_t sese::io::ByteBuffer::read ( void * buffer,
size_t len )
overridevirtual

◆ resetPos()

void sese::io::ByteBuffer::resetPos ( )
overridevirtual

◆ trunc()

int64_t sese::io::ByteBuffer::trunc ( size_t length)
overridevirtual

仅步进,不读取内容

参数
length步进大小
返回
实际步进大小

重载 sese::io::AbstractByteBuffer .

引用了 sese::io::AbstractByteBuffer::trunc().

◆ write()

int64_t sese::io::ByteBuffer::write ( const void * buffer,
size_t len )
overridevirtual

类成员变量说明

◆ mutex

std::mutex sese::io::ByteBuffer::mutex
private

被这些函数引用 read().


该类的文档由以下文件生成: