5 #ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_BYTE_BUFFER_STREAMS_H_
6 #define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_BYTE_BUFFER_STREAMS_H_
24 : bytes_(bytes), size_(size) {}
30 if (location_ >= size_) {
31 std::cerr <<
"Invalid read in StandardCodecByteStreamReader" << std::endl;
34 return bytes_[location_++];
38 void ReadBytes(uint8_t* buffer,
size_t length)
override {
39 if (location_ + length > size_) {
40 std::cerr <<
"Invalid read in StandardCodecByteStreamReader" << std::endl;
43 std::memcpy(buffer, &bytes_[location_], length);
49 uint8_t mod = location_ % alignment;
51 location_ += alignment - mod;
57 const uint8_t* bytes_;
77 void WriteByte(uint8_t
byte) { bytes_->push_back(
byte); }
82 bytes_->insert(bytes_->end(), bytes, bytes + length);
87 uint8_t mod = bytes_->size() % alignment;
89 for (
int i = 0; i < alignment - mod; ++i) {
97 std::vector<uint8_t>* bytes_;
102 #endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_BYTE_BUFFER_STREAMS_H_