5Stream::Stream() : m_endian(std::endian::big), m_index(0) {}
7Stream::~Stream() =
default;
9void Stream::skip(u32 count) {
14void Stream::jump(u32 index) {
23u16 Stream::read_u16() {
27u32 Stream::read_u32() {
31u64 Stream::read_u64() {
39s16 Stream::read_s16() {
43s32 Stream::read_s32() {
47s64 Stream::read_s64() {
51f32 Stream::read_f32() {
55f64 Stream::read_f64() {
59RamStream::RamStream() : m_buffer(nullptr), m_size(0) {}
61RamStream::RamStream(
const void *buffer, u32 size) {
62 setBufferAndSize(
const_cast<void *
>(buffer), size);
65void RamStream::read(
void *output, u32 size) {
66 u8 *buffer =
reinterpret_cast<u8 *
>(output);
67 for (
size_t i = 0; i < size; ++i) {
68 buffer[i] = m_buffer[m_index + i];
72void RamStream::write(
void *input, u32 size) {
73 u8 *buffer =
reinterpret_cast<u8 *
>(input);
74 for (
size_t i = 0; i < size; ++i) {
75 m_buffer[m_index + i] = buffer[i];
80std::string RamStream::read_string() {
81 std::string ret(
reinterpret_cast<char *
>(m_buffer + m_index));
82 m_index += ret.size() + 1;
87void RamStream::setBufferAndSize(
void *buffer, u32 size) {
88 m_buffer =
reinterpret_cast<u8 *
>(buffer);
A stream of data stored in memory.