BinaryReader.h 696 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef BELL_BINARY_READER_H
  2. #define BELL_BINARY_READER_H
  3. #include <stdlib.h>
  4. #include <iostream>
  5. #include <fstream>
  6. #include <vector>
  7. #include <cstring>
  8. #include <memory>
  9. #include "ByteStream.h"
  10. namespace bell
  11. {
  12. class BinaryReader
  13. {
  14. std::shared_ptr<ByteStream> stream;
  15. size_t currentPos = 0;
  16. public:
  17. BinaryReader(std::shared_ptr<ByteStream> stream);
  18. int32_t readInt();
  19. int16_t readShort();
  20. uint32_t readUInt();
  21. long long readLong();
  22. void close();
  23. uint8_t readByte();
  24. size_t size();
  25. size_t position();
  26. std::vector<uint8_t> readBytes(size_t);
  27. void skip(size_t);
  28. };
  29. }
  30. #endif