| 387 | } |
| 388 | |
| 389 | void ReadStream::ReadJson(ISerializable* obj) |
| 390 | { |
| 391 | int32 engineBuild, size; |
| 392 | ReadInt32(&engineBuild); |
| 393 | ReadInt32(&size); |
| 394 | if (obj) |
| 395 | { |
| 396 | if (const auto memoryStream = dynamic_cast<MemoryReadStream*>(this)) |
| 397 | { |
| 398 | JsonSerializer::LoadFromBytes(obj, Span<byte>((byte*)memoryStream->Move(size), size), engineBuild); |
| 399 | } |
| 400 | else |
| 401 | { |
| 402 | void* data = Allocator::Allocate(size); |
| 403 | ReadBytes(data, size); |
| 404 | JsonSerializer::LoadFromBytes(obj, Span<byte>((byte*)data, size), engineBuild); |
| 405 | Allocator::Free(data); |
| 406 | } |
| 407 | } |
| 408 | else |
| 409 | SetPosition(GetPosition() + size); |
| 410 | } |
| 411 | |
| 412 | void ReadStream::ReadStringAnsi(StringAnsi* data) |
| 413 | { |
nothing calls this directly
no test coverage detected