# StreamPartReader.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/mime/multipart/StreamPartReader.hpp"

# PartReaderStreamProvider

Stream provider for StreamPartReader.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class PartReaderStreamProvider {}
}}}}

# Typedefs

Type Name Summary
oatpp::data::stream::OutputStream OutputStream Convenience typedef for oatpp::data::stream::OutputStream.
oatpp::data::stream::InputStream InputStream Convenience typedef for oatpp::data::stream::InputStream.

# Methods

Return Type Name Summary
[none] ~PartReaderStreamProvider Default virtual destructor.
std::shared_ptr<OutputStream> getOutputStream Get stream to write (save) part data in.
std::shared_ptr<InputStream> getInputStream Get stream to read part data from.

# PartReaderStreamProvider::OutputStream

Convenience typedef for oatpp::data::stream::OutputStream.

typedef oatpp::data::stream::OutputStream OutputStream

# PartReaderStreamProvider::InputStream

Convenience typedef for oatpp::data::stream::InputStream.

typedef oatpp::data::stream::InputStream InputStream

# PartReaderStreamProvider::~PartReaderStreamProvider

Default virtual destructor.

virtual ~PartReaderStreamProvider() = default

# PartReaderStreamProvider::getOutputStream

Get stream to write (save) part data in.

  • @param part
  • @return

virtual std::shared_ptr<OutputStream> getOutputStream(const std::shared_ptr<Part>& part) = 0

# PartReaderStreamProvider::getInputStream

Get stream to read part data from.
This method is called after all data has been streamed to OutputStream.

  • @param part
  • @return

virtual std::shared_ptr<InputStream> getInputStream(const std::shared_ptr<Part>& part) = 0

# AsyncPartReaderStreamProvider

Async stream provider for AsyncStreamPartReader.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class AsyncPartReaderStreamProvider {}
}}}}

# Typedefs

Type Name Summary
oatpp::data::stream::OutputStream OutputStream Convenience typedef for oatpp::data::stream::OutputStream.
oatpp::data::stream::InputStream InputStream Convenience typedef for oatpp::data::stream::InputStream.

# Methods

Return Type Name Summary
[none] ~AsyncPartReaderStreamProvider Default virtual destructor.
async::CoroutineStarter getOutputStreamAsync Get stream to write (save) part data to.
async::CoroutineStarter getInputStreamAsync Get stream to read part data from.

# AsyncPartReaderStreamProvider::OutputStream

Convenience typedef for oatpp::data::stream::OutputStream.

typedef oatpp::data::stream::OutputStream OutputStream

# AsyncPartReaderStreamProvider::InputStream

Convenience typedef for oatpp::data::stream::InputStream.

typedef oatpp::data::stream::InputStream InputStream

# AsyncPartReaderStreamProvider::~AsyncPartReaderStreamProvider

Default virtual destructor.

virtual ~AsyncPartReaderStreamProvider() = default

# AsyncPartReaderStreamProvider::getOutputStreamAsync

Get stream to write (save) part data to.

  • @param part
  • @param stream - put here pointer to obtained stream.
  • @return

virtual async::CoroutineStarter getOutputStreamAsync(const std::shared_ptr<Part>& part,
                                                     std::shared_ptr<data::stream::OutputStream>& stream) = 0

# AsyncPartReaderStreamProvider::getInputStreamAsync

Get stream to read part data from.
This method is called after all data has been streamed to OutputStream.

  • @param part
  • @param stream - put here pointer to obtained stream.
  • @return

virtual async::CoroutineStarter getInputStreamAsync(const std::shared_ptr<Part>& part,
                                                    std::shared_ptr<data::stream::InputStream>& stream) = 0

# StreamPartReader

Part reader used in order to stream part data.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class StreamPartReader : public PartReader {}
}}}}

# Methods

Return Type Name Summary
[none] StreamPartReader Constructor.
void onNewPart Called when new part headers are parsed and part object is created.
void onPartData Called on each new chunk of data is parsed for the multipart-part.

# StreamPartReader::StreamPartReader

Constructor.

  • @param streamProvider
  • @param maxDataSize - use -1 for no limit.

StreamPartReader(const std::shared_ptr<PartReaderStreamProvider>& streamProvider,
                 v_io_size maxDataSize = -1)

# StreamPartReader::onNewPart

Called when new part headers are parsed and part object is created.

  • @param part

void onNewPart(const std::shared_ptr<Part>& part) override

# StreamPartReader::onPartData

Called on each new chunk of data is parsed for the multipart-part.
When all data is read, called again with data == nullptr size == 0 to indicate end of the part.

  • @param part
  • @param data - pointer to buffer containing chunk data.
  • @param size - size of the buffer.

void onPartData(const std::shared_ptr<Part>& part, p_char8 data, oatpp::v_io_size size) override

# AsyncStreamPartReader

Async part reader used in order to stream part data in Asynchronous manner.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class AsyncStreamPartReader : public AsyncPartReader {}
}}}}

# Methods

Return Type Name Summary
[none] AsyncStreamPartReader Constructor.
async::CoroutineStarter onNewPartAsync Called when new part headers are parsed and part object is created.
async::CoroutineStarter onPartDataAsync Called on each new chunk of data is parsed for the multipart-part.

# AsyncStreamPartReader::AsyncStreamPartReader

Constructor.

  • @param streamProvider
  • @param maxDataSize - use -1 for no limit.

AsyncStreamPartReader(const std::shared_ptr<AsyncPartReaderStreamProvider>& streamProvider,
                      v_io_size maxDataSize = -1)

# AsyncStreamPartReader::onNewPartAsync

Called when new part headers are parsed and part object is created.

async::CoroutineStarter onNewPartAsync(const std::shared_ptr<Part>& part) override

# AsyncStreamPartReader::onPartDataAsync

Called on each new chunk of data is parsed for the multipart-part.
When all data is read, called again with data == nullptr size == 0 to indicate end of the part.

async::CoroutineStarter onPartDataAsync(const std::shared_ptr<Part>& part, p_char8 data, oatpp::v_io_size size) override