| 108 | } |
| 109 | |
| 110 | bool ByteStream::load( const std::string& filename ) |
| 111 | { |
| 112 | std::ifstream file(filename.c_str(), std::ios::in | std::ios::binary); |
| 113 | |
| 114 | if (file) |
| 115 | { |
| 116 | file.seekg(0, file.end); |
| 117 | auto len = file.tellg(); |
| 118 | file.seekg(0, file.beg); |
| 119 | |
| 120 | _buffer.resize(len); |
| 121 | file.read(reinterpret_cast<char*>(&_buffer[0]), len); |
| 122 | |
| 123 | file.close(); |
| 124 | return true; |
| 125 | } |
| 126 | else |
| 127 | SIBR_WRG << "cannot load ByteStream from file '" << filename << "'." << std::endl; |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | void ByteStream::saveToFile( const std::string& filename ) |
| 132 | { |
no test coverage detected