azure-core
Public Member Functions | List of all members
Azure::Core::IO::BodyStream Class Referenceabstract

Used to read data to/from a service.

#include <body_stream.hpp>

Inheritance diagram for Azure::Core::IO::BodyStream:
Azure::Core::IO::FileBodyStream Azure::Core::IO::MemoryBodyStream Azure::Core::IO::ProgressBodyStream

Public Member Functions

virtual ~BodyStream ()=default
 Destructs BodyStream. More...
 
virtual int64_t Length () const =0
 Get the length of the data. More...
 
virtual void Rewind ()
 
size_t Read (uint8_t *buffer, size_t count, Azure::Core::Context const &context=Azure::Core::Context())
 Read portion of data into a buffer. More...
 
size_t ReadToCount (uint8_t *buffer, size_t count, Azure::Core::Context const &context=Azure::Core::Context())
 Read Azure::Core::IO::BodyStream into a buffer until the buffer is filled, or until the stream is read to end. More...
 
std::vector< uint8_t > ReadToEnd (Azure::Core::Context const &context=Azure::Core::Context())
 Read Azure::Core::IO::BodyStream until the stream is read to end, allocating memory for the entirety of contents. More...
 

Constructor & Destructor Documentation

◆ ~BodyStream()

virtual Azure::Core::IO::BodyStream::~BodyStream ( )
virtualdefault

Member Function Documentation

◆ Length()

virtual int64_t Azure::Core::IO::BodyStream::Length ( ) const
pure virtual
Remarks
Used with the HTTP Content-Length header.

Implemented in Azure::Core::IO::ProgressBodyStream, Azure::Core::IO::FileBodyStream, and Azure::Core::IO::MemoryBodyStream.

◆ Read()

size_t Azure::Core::IO::BodyStream::Read ( uint8_t *  buffer,
size_t  count,
Azure::Core::Context const &  context = Azure::Core::Context() 
)
inline
Remarks
Throws if error/cancelled.
Parameters
bufferPointer to a first byte of the byte buffer to read the data into.
countSize of the buffer to read the data into.
contextA context to control the request lifetime.
Returns
Number of bytes read.

◆ ReadToCount()

size_t BodyStream::ReadToCount ( uint8_t *  buffer,
size_t  count,
Azure::Core::Context const &  context = Azure::Core::Context() 
)
Parameters
bufferPointer to a first byte of the byte buffer to read the data into.
countSize of the buffer to read the data into.
contextA context to control the request lifetime.
Returns
Number of bytes read.

◆ ReadToEnd()

std::vector< uint8_t > BodyStream::ReadToEnd ( Azure::Core::Context const &  context = Azure::Core::Context())
Parameters
contextA context to control the request lifetime.
Returns
A vector of bytes containing the entirety of data read from the body.

The documentation for this class was generated from the following files: