Function extractToStream

Synopsis

#include <include/bitarchiveopener.hpp>

void extractToStream(const BitInputArchive &in_archive, ostream &out_stream, unsigned int index) const

Description

No description yet.

Source

Lines 58-73 in src/bitarchiveopener.cpp. Line 68 in include/bitarchiveopener.hpp.

void BitArchiveOpener::extractToStream( const BitInputArchive& in_archive,
                                        std::ostream& out_stream,
                                        unsigned int index ) const {
    uint32_t number_items = in_archive.itemsCount();
    if ( index >= number_items ) {
        throw BitException( L"Index " + std::to_wstring( index ) + L" is out of range", E_INVALIDARG );
    }

    if ( in_archive.isItemFolder( index ) ) { //Consider only files, not folders
        throw BitException( kCannotExtractFolderToBuffer, E_INVALIDARG );
    }

    const vector< uint32_t > indices( 1, index );
    CMyComPtr< ExtractCallback > extract_callback = new StreamExtractCallback( *this, in_archive, out_stream );
    in_archive.extract( indices, extract_callback );
}





Add Discussion as Guest

Log in