Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | Properties | List of all members
FlutterStandardTypedData Class Reference

#import <FlutterCodecs.h>

Inheritance diagram for FlutterStandardTypedData:

Instance Methods

(instancetype) - initWithData:type: [implementation]
 
(BOOL- isEqual: [implementation]
 
(NSUInteger) - hash [implementation]
 

Class Methods

(instancetype) + typedDataWithBytes:
 
(instancetype) + typedDataWithInt32:
 
(instancetype) + typedDataWithInt64:
 
(instancetype) + typedDataWithFloat32:
 
(instancetype) + typedDataWithFloat64:
 
(instancetype) + typedDataWithData:type: [implementation]
 

Properties

NSData * data
 
FlutterStandardDataType type
 
UInt32 elementCount
 
UInt8 elementSize
 

Detailed Description

A byte buffer holding UInt8, SInt32, SInt64, or Float64 values, used with FlutterStandardMessageCodec and FlutterStandardMethodCodec.

Two's complement encoding is used for signed integers. IEEE754 double-precision representation is used for floats. The platform's native endianness is assumed.

Definition at line 300 of file FlutterCodecs.h.

Method Documentation

◆ hash

- (NSUInteger) hash
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

195 {
196 return [self.data hash] ^ self.type;
197}

◆ initWithData:type:

- (instancetype) initWithData: (NSData*)  data
type: (FlutterStandardDataType)  type 
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

170 :(NSData*)data type:(FlutterStandardDataType)type {
172 NSAssert(data, @"Data cannot be nil");
173 NSAssert(data.length % elementSize == 0, @"Data must contain integral number of elements");
174 self = [super init];
175 NSAssert(self, @"Super init cannot be nil");
176 _data = [data copy];
177 _type = type;
178 _elementSize = elementSize;
179 _elementCount = data.length / elementSize;
180 return self;
181}
FlutterStandardDataType type
UInt8 elementSizeForFlutterStandardDataType(FlutterStandardDataType type)

◆ isEqual:

- (BOOL) isEqual: (id object
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

183 :(id)object {
184 if (self == object) {
185 return YES;
186 }
187 if (![object isKindOfClass:[FlutterStandardTypedData class]]) {
188 return NO;
189 }
191 return self.type == other.type && self.elementCount == other.elementCount &&
192 [self.data isEqual:other.data];
193}
const uintptr_t id

◆ typedDataWithBytes:

+ (instancetype) typedDataWithBytes: (NSData*)  data

Creates a FlutterStandardTypedData which interprets the specified data as plain bytes.

Parameters
datathe byte data.

Definition at line 8 of file FlutterStandardCodec.mm.

146 :(NSData*)data {
147 return [FlutterStandardTypedData typedDataWithData:data type:FlutterStandardDataTypeUInt8];
148}
instancetype typedDataWithData:type:(NSData *data, [type] FlutterStandardDataType type)

◆ typedDataWithData:type:

+ (instancetype) typedDataWithData: (NSData*)  data
type: (FlutterStandardDataType)  type 
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

166 :(NSData*)data type:(FlutterStandardDataType)type {
167 return [[FlutterStandardTypedData alloc] initWithData:data type:type];
168}

◆ typedDataWithFloat32:

+ (instancetype) typedDataWithFloat32: (NSData*)  data

Creates a FlutterStandardTypedData which interprets the specified data as 32-bit floats.

Parameters
datathe byte data. The length must be divisible by 8.

Definition at line 8 of file FlutterStandardCodec.mm.

158 :(NSData*)data {
159 return [FlutterStandardTypedData typedDataWithData:data type:FlutterStandardDataTypeFloat32];
160}

◆ typedDataWithFloat64:

+ (instancetype) typedDataWithFloat64: (NSData*)  data

Creates a FlutterStandardTypedData which interprets the specified data as 64-bit floats.

Parameters
datathe byte data. The length must be divisible by 8.

Definition at line 8 of file FlutterStandardCodec.mm.

162 :(NSData*)data {
163 return [FlutterStandardTypedData typedDataWithData:data type:FlutterStandardDataTypeFloat64];
164}

◆ typedDataWithInt32:

+ (instancetype) typedDataWithInt32: (NSData*)  data

Creates a FlutterStandardTypedData which interprets the specified data as 32-bit signed integers.

Parameters
datathe byte data. The length must be divisible by 4.

Definition at line 8 of file FlutterStandardCodec.mm.

150 :(NSData*)data {
151 return [FlutterStandardTypedData typedDataWithData:data type:FlutterStandardDataTypeInt32];
152}

◆ typedDataWithInt64:

+ (instancetype) typedDataWithInt64: (NSData*)  data

Creates a FlutterStandardTypedData which interprets the specified data as 64-bit signed integers.

Parameters
datathe byte data. The length must be divisible by 8.

Definition at line 8 of file FlutterStandardCodec.mm.

154 :(NSData*)data {
155 return [FlutterStandardTypedData typedDataWithData:data type:FlutterStandardDataTypeInt64];
156}

Property Documentation

◆ data

- (NSData*) data
readnonatomicassign

The raw underlying data buffer.

Definition at line 344 of file FlutterCodecs.h.

◆ elementCount

- (UInt32) elementCount
readnonatomicassign

The number of value items encoded.

Definition at line 354 of file FlutterCodecs.h.

◆ elementSize

- (UInt8) elementSize
readnonatomicassign

The number of bytes used by the encoding of a single value item.

Definition at line 359 of file FlutterCodecs.h.

◆ type

- (FlutterStandardDataType) type
readnonatomicassign

The type of the encoded values.

Definition at line 349 of file FlutterCodecs.h.


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