| 16 | } |
| 17 | |
| 18 | void ObjectHeaderBase::read(AbstractFile& is) { |
| 19 | /* let us be more robust, when reading */ |
| 20 | uint32_t tmp = 0; |
| 21 | while (tmp != ObjectSignature) { |
| 22 | is.read(reinterpret_cast<char *>(&tmp), sizeof(tmp)); |
| 23 | if (tmp == ObjectSignature) { |
| 24 | signature = tmp; |
| 25 | } else { |
| 26 | if (is.eof()) { |
| 27 | throw Exception("ObjectHeaderBase::read(): End of File."); |
| 28 | } |
| 29 | |
| 30 | if ((0xffffff00 & tmp) == 0x424f4c00) { |
| 31 | is.seekg(-3, std::ios_base::cur); |
| 32 | } else if ((0xffff0000 & tmp) == 0x4f4c0000) { |
| 33 | is.seekg(-2, std::ios_base::cur); |
| 34 | } else if ((0xff000000 & tmp) == 0x4c000000) { |
| 35 | is.seekg(-1, std::ios_base::cur); |
| 36 | } else { |
| 37 | /* do not seek as we did not find a single char */ |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | is.read(reinterpret_cast<char*>(&headerSize), sizeof(headerSize)); |
| 42 | is.read(reinterpret_cast<char*>(&headerVersion), sizeof(headerVersion)); |
| 43 | is.read(reinterpret_cast<char*>(&objectSize), sizeof(objectSize)); |
| 44 | is.read(reinterpret_cast<char*>(&objectType), sizeof(objectType)); |
| 45 | } |
| 46 | |
| 47 | void ObjectHeaderBase::write(AbstractFile& os) { |
| 48 | /* pre processing */ |