blob: f3f07595f62f0adba2f8f317b69ab5ccc370e75b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "ysaveload.h"
#include <util/generic/buffer.h>
void TSerializer<TBuffer>::Save(IOutputStream* rh, const TBuffer& buf) {
::SaveSize(rh, buf.Size());
::SavePodArray(rh, buf.Data(), buf.Size());
}
void TSerializer<TBuffer>::Load(IInputStream* rh, TBuffer& buf) {
const size_t s = ::LoadSize(rh);
buf.Resize(s);
::LoadPodArray(rh, buf.Data(), buf.Size());
}
[[noreturn]] void NPrivate::ThrowLoadEOFException(size_t typeSize, size_t realSize, TStringBuf structName) {
ythrow TLoadEOF() << "can not load " << structName << "(" << typeSize << ", " << realSize << " bytes)";
}
[[noreturn]] void NPrivate::ThrowUnexpectedVariantTagException(ui8 tagIndex) {
ythrow TLoadEOF() << "Unexpected tag value " << tagIndex << " while loading TVariant";
}
|