| Flutter macOS Embedder |

Instance Methods | List of all members
FlutterStandardReader Class Reference

`#import <FlutterCodecs.h>`

Inheritance diagram for FlutterStandardReader:

## Instance Methods
(instancetype) | - initWithData:
(BOOL) | - hasMore
(UInt8) | - readByte
(void) | - readBytes:length:
(NSData *) | - readData:
(UInt32) | - readSize
(void) | - readAlignment:
(NSString *) | - readUTF8
(nullable id) | - readValue
(nullable id) | - readValueOfType:

## Detailed Description

A reader of the Flutter standard binary encoding.

See `FlutterStandardMessageCodec` for details on the encoding.

The encoding is extensible via subclasses overriding `readValueOfType`.

Definition at line 132 of file FlutterCodecs.h.

## Method Documentation

## ◆ hasMore

- (BOOL) hasMore |  |  |

Returns YES when the reader hasn't reached the end of its data.

Definition at line 356 of file FlutterStandardCodec.mm.

367 {
368 return _range.location < _data.length;
369 }
_range
NSRange _range
Definition: FlutterStandardCodec.mm:354

## ◆ initWithData:

- (instancetype) initWithData: |  | (NSData*) | data |

Create a new `FlutterStandardReader` who reads from `data`.

Definition at line 356 of file FlutterStandardCodec.mm.

359 :(NSData*)data {
360 self = [super init];
361 NSAssert(self, @"Super init cannot be nil");
362 _data = [data copy];
363 _range = NSMakeRange(0, 0);
364 return self;
365 }

## ◆ readAlignment:

- (void) readAlignment: |  | (UInt8) | alignment |

Advances the read position until it is aligned with `alignment`.

Definition at line 356 of file FlutterStandardCodec.mm.

396 :(UInt8)alignment {
397 FlutterStandardCodecHelperReadAlignment(&_range.location, alignment);
398 }
FlutterStandardCodecHelperReadAlignment
void FlutterStandardCodecHelperReadAlignment(unsigned long *location, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:18

## ◆ readByte

- (UInt8) readByte |  |  |

Reads a byte value and increments the position.

Definition at line 356 of file FlutterStandardCodec.mm.

376 {
377 return FlutterStandardCodecHelperReadByte(&_range.location, (__bridge CFDataRef)_data);
378 }
FlutterStandardCodecHelperReadByte
uint8_t FlutterStandardCodecHelperReadByte(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:42

## ◆ readBytes:length:

- (void) readBytes: |  | (void*) | destination
length: |  | (NSUInteger) | length

Reads a sequence of byte values of `length` and increments the position.

Definition at line 356 of file FlutterStandardCodec.mm.

371 :(void*)destination length:(NSUInteger)length {
372 FlutterStandardCodecHelperReadBytes(&_range.location, length, destination,
373 (__bridge CFDataRef)_data);
374 }
FlutterStandardCodecHelperReadBytes
void FlutterStandardCodecHelperReadBytes(unsigned long *location, unsigned long length, void *destination, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:33

## ◆ readData:

- (NSData *) readData: |  | (NSUInteger) | length |

Reads a sequence of byte values of `length` and increments the position.

Definition at line 356 of file FlutterStandardCodec.mm.

384 :(NSUInteger)length {
385 _range.length = length;
386 NSData* data = [_data subdataWithRange:_range];
387 _range.location += _range.length;
388 return data;
389 }

## ◆ readSize

- (UInt32) readSize |  |  |

Reads a 32-bit unsigned integer representing a collection size and increments the position.

Definition at line 356 of file FlutterStandardCodec.mm.

380 {
381 return FlutterStandardCodecHelperReadSize(&_range.location, (__bridge CFDataRef)_data);
382 }
FlutterStandardCodecHelperReadSize
uint32_t FlutterStandardCodecHelperReadSize(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:49

## ◆ readUTF8

- (NSString *) readUTF8 |  |  |

Read a null terminated string encoded with UTF-8/

Definition at line 356 of file FlutterStandardCodec.mm.

391 {
392 return (__bridge NSString*)FlutterStandardCodecHelperReadUTF8(&_range.location,
393 (__bridge CFDataRef)_data);
394 }
FlutterStandardCodecHelperReadUTF8
CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:75

## ◆ readValue

- (nullable id) readValue |  |  |

Reads a byte for `FlutterStandardField` the decodes a value matching that type.

See also: -[FlutterStandardWriter writeValue]

Definition at line 356 of file FlutterStandardCodec.mm.

400 {
401 return (__bridge id)ReadValue((__bridge CFTypeRef)self);
402 }

## ◆ readValueOfType:

- (nullable id) readValueOfType: |  | (UInt8) | type |

Decodes a value matching the `type` specified.

See also:

- `FlutterStandardField`
- `-[FlutterStandardWriter writeValue]`

Reimplemented in ExtendedReader.

Definition at line 411 of file FlutterStandardCodec.mm.

429 :(UInt8)type {
430 return (__bridge id)FlutterStandardCodecHelperReadValueOfType(
431 &_range.location, (__bridge CFDataRef)_data, type, ReadValue, ReadTypedDataOfType,
432 (__bridge CFTypeRef)self);
433 }
FlutterStandardCodecHelperReadValueOfType
CFTypeRef FlutterStandardCodecHelperReadValueOfType(unsigned long *location, CFDataRef data, uint8_t type, CFTypeRef(*ReadValue)(CFTypeRef), CFTypeRef(*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef), CFTypeRef user_data)
Definition: FlutterStandardCodecHelper.cc:103

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

- shell/platform/darwin/common/framework/Headers/FlutterCodecs.h
- shell/platform/darwin/common/framework/Source/FlutterStandardCodec.mm