ChunkedBuffer.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/data/stream/ChunkedBuffer.hpp"

ChunkedBuffer

Buffer wich can grow by chunks and implements oatpp::data::stream::OutputStream interface.

namespace oatpp { namespace data { namespace stream { 
  class ChunkedBuffer : public oatpp::base::Countable, public OutputStream, public std::enable_shared_from_this<ChunkedBuffer> {}
}}}

Methods

Return Type Name Summary
[none] ChunkedBuffer Multiple implementations:
  1. Constructor.
  2. Deleted copy constructor.
[none] ~ChunkedBuffer Virtual Destructor.
std::shared_ptr<ChunkedBuffer> createShared Create shared ChunkedBuffer.
data::v_io_size write Write data to ChunkedBuffer. Implementation of oatpp::data::stream::OutputStream::write() method.
data::v_io_size readSubstring Read part of ChunkedBuffer to buffer.
oatpp::String getSubstring Create oatpp::String from part of ChunkedBuffer.
oatpp::String toString Create oatpp::String from all data in ChunkedBuffer.
bool flushToStream Write all data from ChunkedBuffer to oatpp::data::stream::OutputStream.
oatpp::async::CoroutineStarter flushToStreamAsync Write all data from ChunkedBuffer to oatpp::data::stream::OutputStream in asynchronous manner.
data::v_io_size getSize Get number of bytes written to ChunkedBuffer.
void clear Clear data in ChunkedBuffer.

ChunkedBuffer::ChunkedBuffer

  1. Constructor.
    ChunkedBuffer()
    
  2. Deleted copy constructor.
    ChunkedBuffer(const ChunkedBuffer&) = delete
    

ChunkedBuffer::~ChunkedBuffer

Virtual Destructor.

~ChunkedBuffer()

ChunkedBuffer::createShared

Create shared ChunkedBuffer.

  • @return std::shared_ptr to ChunkedBuffer.

static std::shared_ptr<ChunkedBuffer> createShared()

ChunkedBuffer::write

Write data to ChunkedBuffer. Implementation of oatpp::data::stream::OutputStream::write() method.

  • @param data - data to write.
  • @param count - size of data in bytes.
  • @return - actual number of bytes written.

data::v_io_size write(const void *data, data::v_io_size count) override

ChunkedBuffer::readSubstring

Read part of ChunkedBuffer to buffer.

  • @param buffer - buffer to write data to.
  • @param pos - starting position in ChunkedBuffer to read data from.
  • @param count - number of bytes to read.
  • @return - actual number of bytes read from ChunkedBuffer and written to buffer.

data::v_io_size readSubstring(void *buffer, data::v_io_size pos, data::v_io_size count)

ChunkedBuffer::getSubstring

Create oatpp::String from part of ChunkedBuffer.

oatpp::String getSubstring(data::v_io_size pos, data::v_io_size count)

ChunkedBuffer::toString

Create oatpp::String from all data in ChunkedBuffer.

oatpp::String toString()

ChunkedBuffer::flushToStream

Write all data from ChunkedBuffer to oatpp::data::stream::OutputStream. ChunkedBuffer will not be cleared during this call!

  • @param stream - oatpp::data::stream::OutputStream stream to write all data to.
  • @return - true if no errors occured. will be refactored to return actual amount of bytes flushed.

bool flushToStream(const std::shared_ptr<OutputStream>& stream)

ChunkedBuffer::flushToStreamAsync

Write all data from ChunkedBuffer to oatpp::data::stream::OutputStream in asynchronous manner.

oatpp::async::CoroutineStarter flushToStreamAsync(const std::shared_ptr<OutputStream>& stream)

ChunkedBuffer::getSize

Get number of bytes written to ChunkedBuffer.

  • @return - number of bytes written to ChunkedBuffer.

data::v_io_size getSize()

ChunkedBuffer::clear

Clear data in ChunkedBuffer.

void clear()