MCPcopy Create free account
hub / github.com/crosire/blink / stream

Method stream

source/msf_reader.cpp:123–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123std::vector<char> blink::msf_reader::stream(size_t index)
124{
125 const content_stream &stream = _streams[index];
126
127 size_t offset = 0;
128 std::vector<char> stream_data( // Allocate enough memory to hold all associated pages
129 stream.page_indices.size() * _page_size);
130
131 // Iterate through all pages associated with this stream and read their data
132 for (uint32_t page_index : stream.page_indices)
133 {
134 _file_stream.seekg(page_index * _page_size);
135 _file_stream.read(stream_data.data() + offset, _page_size);
136
137 offset += _page_size;
138 }
139
140 // Shrink result to the actual stream size
141 stream_data.resize(stream.size);
142
143 return stream_data;
144}

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
readMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected