20#ifndef WXSTREAM_HELPER_H
21#define WXSTREAM_HELPER_H
25#include <wx/wfstream.h>
28static bool CopyStreamData( wxInputStream& inputStream, wxOutputStream& outputStream,
31 constexpr size_t bufSize = 128 * 1024;
32 std::vector<wxChar> buf( bufSize );
34 wxFileOffset copiedData = 0;
35 wxFileOffset readSize = bufSize;
39 if(size != -1 && copiedData + readSize > size )
40 readSize = size - copiedData;
42 inputStream.Read( buf.data(), readSize );
44 size_t actuallyRead = inputStream.LastRead();
45 outputStream.Write( buf.data(), actuallyRead );
47 if( outputStream.LastWrite() != actuallyRead )
49 wxLogError(
_(
"Failed to output data") );
55 if( inputStream.Eof() )
60 copiedData += actuallyRead;
62 if( copiedData >= size )
static bool CopyStreamData(wxInputStream &inputStream, wxOutputStream &outputStream, wxFileOffset size)