15 static void writeStringSection(
const std::string& s, std::ostream& outputStream)
18 size_t slen = strlen(s.c_str()) + 1;
21 boost::uint16_t len =
swapBigEndian(static_cast<boost::uint16_t>(slen));
23 if (!outputStream.write(reinterpret_cast<char*>(&len),
sizeof(len)))
26 if (!outputStream.write(s.c_str(), slen))
throw IOException();
30 static void writeDataSection(
const boost::uint32_t* words,
size_t wordCount, std::ostream& outputStream)
33 boost::uint32_t w =
swapBigEndian(static_cast<boost::uint32_t>(wordCount << 2));
35 if (!outputStream.write(reinterpret_cast<char*>(&w),
sizeof(w)))
38 for (
size_t i = 0; i < wordCount; ++i)
41 if (!outputStream.write(reinterpret_cast<const char*>(&w),
sizeof(w)))
64 writeStringSection(bitFileData.
creationDate(), outputStream);
68 writeStringSection(bitFileData.
creationTime(), outputStream);