Loading...
Searching...
No Matches
mongocxx::v_noabi::gridfs::downloader Class Reference

`#include <mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp>`

## Description

Used to download a GridFS file.

## Public Member Functions

| downloader () noexcept
| Default constructs a downloader object. The downloader is equivalent to the state of a moved from downloader. The only valid actions to take with a default constructed downloader are to assign to it, or destroy it.
| downloader (downloader &&other) noexcept=default
| Move constructs a downloader.
| downloader (v1::gridfs::downloader downloader)
| Construct with the mongocxx::v1 equivalent.
| ~downloader ()=default
| Destroys a downloader.
std::int32_t | chunk_size () const
| Gets the chunk size of the file being downloaded.
void | close ()
| Closes the downloader stream.
std::int64_t | file_length () const
| Gets the length of the file being downloaded.
bsoncxx::v_noabi::document::view | files_document () const
| Gets the files collection document of the file being downloaded.
| operator bool () const noexcept
| Returns true if the downloader is valid, meaning it was not default constructed or moved from.
| operator v1::gridfs::downloader () &&
| Convert to the mongocxx::v1 equivalent.
| operator v1::gridfs::downloader () const &=delete
| This class is not copyable.
downloader & | operator= (downloader &&other) noexcept=default
| Move assigns a downloader.
std::size_t | read (std::uint8_t *buffer, std::size_t length)
| Reads a specified number of bytes from the GridFS file being downloaded.

## Constructor & Destructor Documentation

## downloader() [1/3]

mongocxx::v_noabi::gridfs::downloader::downloader | ( |  | ) |

inline noexcept

Default constructs a downloader object. The downloader is equivalent to the state of a moved from downloader. The only valid actions to take with a default constructed downloader are to assign to it, or destroy it.

## downloader() [2/3]

mongocxx::v_noabi::gridfs::downloader::downloader | ( | downloader && | other | ) |

default noexcept

Move constructs a downloader.

## ~downloader()

mongocxx::v_noabi::gridfs::downloader::~downloader | ( |  | ) |

default

Destroys a downloader.

## downloader() [3/3]

mongocxx::v_noabi::gridfs::downloader::downloader | ( | v1::gridfs::downloader | downloader | ) |

inline

Construct with the mongocxx::v1 equivalent.

## Member Function Documentation

## chunk_size()

std::int32_t mongocxx::v_noabi::gridfs::downloader::chunk_size | ( |  | ) | const

Gets the chunk size of the file being downloaded.

Returns
  The chunk size in bytes.

## close()

void mongocxx::v_noabi::gridfs::downloader::close | ( |  | ) |

Closes the downloader stream.

Exceptions

  mongocxx::v_noabi::logic_error | if the download stream was already closed.

## file_length()

std::int64_t mongocxx::v_noabi::gridfs::downloader::file_length | ( |  | ) | const

Gets the length of the file being downloaded.

Returns
  The length in bytes.

## files_document()

bsoncxx::v_noabi::document::view mongocxx::v_noabi::gridfs::downloader::files_document | ( |  | ) | const

Gets the files collection document of the file being downloaded.

Returns
  A view to the files collection document of the file being downloaded.

## operator bool()

mongocxx::v_noabi::gridfs::downloader::operator bool | ( |  | ) | const

inline explicit noexcept

Returns true if the downloader is valid, meaning it was not default constructed or moved from.

## operator v1::gridfs::downloader() [1/2]

mongocxx::v_noabi::gridfs::downloader::operator v1::gridfs::downloader | ( |  | ) | &&

inline explicit

Convert to the mongocxx::v1 equivalent.

Postconditions:
  - *this is in an assign-or-destroy-only state.

Warning
  Invalidates all associated objects.

## operator v1::gridfs::downloader() [2/2]

mongocxx::v_noabi::gridfs::downloader::operator v1::gridfs::downloader | ( |  | ) | const &

explicit delete

This class is not copyable.

## operator=()

downloader & mongocxx::v_noabi::gridfs::downloader::operator= | ( | downloader && | other | ) |

default noexcept

Move assigns a downloader.

## read()

std::size_t mongocxx::v_noabi::gridfs::downloader::read | ( | std::uint8_t * | buffer,
|  | std::size_t | length )

Reads a specified number of bytes from the GridFS file being downloaded.

Parameters

  buffer | A pointer to a buffer to store the bytes read from the file.
  length | The number of bytes to read from the file.

Returns
  The number of bytes actually read. If zero, the downloader has reached the end of the file.

Exceptions

  mongocxx::v_noabi::logic_error | if the download stream was already closed.
  mongocxx::v_noabi::gridfs_exception | if the requested file has been corrupted.
  mongocxx::v_noabi::query_exception | if an error occurs when reading chunk data from the database for the requested file.

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

- mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp