| 158 | } |
| 159 | |
| 160 | void FileStream::read(void* buffer, size_t len) |
| 161 | { |
| 162 | if (_mode != StreamMode::read) |
| 163 | { |
| 164 | throw Exception::InvalidOperation("Can not read"); |
| 165 | } |
| 166 | |
| 167 | const auto bytesRead = readFile(buffer, len, _file); |
| 168 | if (bytesRead != len) |
| 169 | { |
| 170 | throw Exception::RuntimeError("Failed to read data"); |
| 171 | } |
| 172 | |
| 173 | _offset += bytesRead; |
| 174 | } |
| 175 | |
| 176 | void FileStream::write(const void* buffer, size_t len) |
| 177 | { |