BinaryReader.h 623 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <stdint.h> // for uint8_t, int16_t, int32_t, uint32_t
  3. #include <stdlib.h> // for size_t
  4. #include <memory> // for shared_ptr
  5. #include <vector> // for vector
  6. namespace bell {
  7. class ByteStream;
  8. class BinaryReader {
  9. std::shared_ptr<ByteStream> stream;
  10. size_t currentPos = 0;
  11. public:
  12. BinaryReader(std::shared_ptr<ByteStream> stream);
  13. int32_t readInt();
  14. int16_t readShort();
  15. uint32_t readUInt();
  16. long long readLong();
  17. void close();
  18. uint8_t readByte();
  19. size_t size();
  20. size_t position();
  21. std::vector<uint8_t> readBytes(size_t);
  22. void skip(size_t);
  23. };
  24. } // namespace bell