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

A concrete implementation of Azure::Core::IO::BodyStream used for reading data from a file.

#include <body_stream.hpp>

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

Public Member Functions

 FileBodyStream (const std::string &filename)
 Constructs FileBodyStream from a file name. More...
 
 ~FileBodyStream ()
 Closes the file and cleans up any resources. More...
 
void Rewind () override
 
int64_t Length () const override
 Get the length of the data. More...
 
- Public Member Functions inherited from Azure::Core::IO::BodyStream
virtual ~BodyStream ()=default
 Destructs BodyStream. More...
 
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

◆ FileBodyStream()

FileBodyStream::FileBodyStream ( const std::string &  filename)
Parameters
filenameA reference to a file name string used to identify the file, which needs to have the necessary file path specified to locate the file.
Remarks
The Azure::Core::IO::FileBodyStream owns the file object and is responsible for opening and closing the file.
Do not write to the file while it is being used by the stream.

◆ ~FileBodyStream()

FileBodyStream::~FileBodyStream ( )

Member Function Documentation

◆ Length()

int64_t FileBodyStream::Length ( ) const
overridevirtual
Remarks
Used with the HTTP Content-Length header.

Implements Azure::Core::IO::BodyStream.


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