Flutter Engine
flutter::ByteBufferStreamReader Class Reference

#include <byte_buffer_streams.h>

Inheritance diagram for flutter::ByteBufferStreamReader:
flutter::ByteStreamReader

Public Member Functions

 ByteBufferStreamReader (const uint8_t *bytes, size_t size)
 
virtual ~ByteBufferStreamReader ()=default
 
uint8_t ReadByte () override
 
void ReadBytes (uint8_t *buffer, size_t length) override
 
void ReadAlignment (uint8_t alignment) override
 
- Public Member Functions inherited from flutter::ByteStreamReader
 ByteStreamReader ()=default
 
virtual ~ByteStreamReader ()=default
 
int32_t ReadInt32 ()
 
int64_t ReadInt64 ()
 
double ReadDouble ()
 

Detailed Description

Definition at line 19 of file byte_buffer_streams.h.

Constructor & Destructor Documentation

◆ ByteBufferStreamReader()

flutter::ByteBufferStreamReader::ByteBufferStreamReader ( const uint8_t *  bytes,
size_t  size 
)
inlineexplicit

Definition at line 23 of file byte_buffer_streams.h.

References ~ByteBufferStreamReader().

24  : bytes_(bytes), size_(size) {}
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ ~ByteBufferStreamReader()

virtual flutter::ByteBufferStreamReader::~ByteBufferStreamReader ( )
virtualdefault

Referenced by ByteBufferStreamReader().

Member Function Documentation

◆ ReadAlignment()

void flutter::ByteBufferStreamReader::ReadAlignment ( uint8_t  alignment)
inlineoverridevirtual

Implements flutter::ByteStreamReader.

Definition at line 48 of file byte_buffer_streams.h.

48  {
49  uint8_t mod = location_ % alignment;
50  if (mod) {
51  location_ += alignment - mod;
52  }
53  }

◆ ReadByte()

uint8_t flutter::ByteBufferStreamReader::ReadByte ( )
inlineoverridevirtual

Implements flutter::ByteStreamReader.

Definition at line 29 of file byte_buffer_streams.h.

Referenced by flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal().

29  {
30  if (location_ >= size_) {
31  std::cerr << "Invalid read in StandardCodecByteStreamReader" << std::endl;
32  return 0;
33  }
34  return bytes_[location_++];
35  }

◆ ReadBytes()

void flutter::ByteBufferStreamReader::ReadBytes ( uint8_t *  buffer,
size_t  length 
)
inlineoverridevirtual

Implements flutter::ByteStreamReader.

Definition at line 38 of file byte_buffer_streams.h.

References length.

38  {
39  if (location_ + length > size_) {
40  std::cerr << "Invalid read in StandardCodecByteStreamReader" << std::endl;
41  return;
42  }
43  std::memcpy(buffer, &bytes_[location_], length);
44  location_ += length;
45  }
size_t length

The documentation for this class was generated from the following file: