39 #include "blocxx/BLOCXX_config.h"
47 namespace BLOCXX_NAMESPACE
50 namespace BinarySerialization
65 write(ostrm, &length_byte, 1);
78 else if (len < (1 << 16))
82 else if (len < (1 << 24))
90 UInt8 netlenlen = lenlen | 0x80UL;
92 write(ostrm, &netlenlen, 1);
93 UInt8 netlen[
sizeof(len)];
94 for (
int j = 0; j < lenlen; j++)
96 netlen[(
sizeof(len)-1) - j] =
static_cast<UInt8>(len & 0xffU);
100 write(ostrm, static_cast<void *>(&netlen[
sizeof(len)-lenlen]), lenlen);
112 UInt8 noctets = lc & 0x7fU;
113 if ( noctets >
sizeof(len) )
115 BLOCXX_THROW(
IOException,
Format(
"Failed reading data: length length (%1) is too large (> %2)", static_cast<int>(noctets),
sizeof(len)).c_str());
117 UInt8 netlen[
sizeof(len)];
118 read(istrm, static_cast<void *>(netlen), noctets);
120 for (
int i = 0;
i < noctets;
i++ )
134 write(std::streambuf & ostrm,
void const * dataOut,
size_t dataOutLen)
136 std::streamsize cnt = dataOutLen;
137 if (ostrm.sputn(static_cast<char const *>(dataOut), cnt) != cnt)
152 Format(
"Received invalid signature. Got: %1 Expected: %2", Int32(val),
153 Int32(validSig)).c_str());
161 bool nullPropertyList = (propertyList == 0);
163 if (!nullPropertyList)
171 read(std::streambuf & istrm,
void * dataIn,
size_t dataInLen)
173 std::streamsize cnt = dataInLen;
174 if (istrm.sgetn(static_cast<char *>(dataIn), cnt) != cnt)