@@ -66,74 +66,76 @@ echo -n "[1, 2, 3]" | bjdata print
6666### Decoding BJData to Dart
6767- Multi dimensional arrays are not yet supported.
6868
69- | BJData Type | Marker | Dart |
70- | ------------------| --------| ---------------|
71- | ` null ` | ` Z ` | ` null ` |
72- | ` true ` | ` T ` | ` true ` |
73- | ` false ` | ` F ` | ` false ` |
74- | ` int8 ` | ` i ` | ` int ` |
75- | ` uint8 ` | ` U ` | ` int ` |
76- | ` int16 ` | ` u ` | ` int ` |
77- | ` uint16 ` | ` I ` | ` int ` |
78- | ` int32 ` | ` l ` | ` int ` |
79- | ` uint32 ` | ` m ` | ` int ` |
80- | ` int64 ` | ` L ` | ` int ` |
81- | ` uint64 ` | ` M ` | ` int ` * |
82- | ` float16 ` | ` h ` | ` double ` |
83- | ` float32 ` | ` d ` | ` double ` |
84- | ` float64 ` | ` D ` | ` double ` |
85- | ` byte ` | ` B ` | ` int ` |
86- | ` char ` | ` C ` | ` String ` |
87- | ` string ` | ` S ` | ` String ` |
88- | ` huge ` | ` H ` | ` BigInt ` |
89- | ` array ` | ` [] ` | ` List ` |
90- | ` array[byte] ` | ` [$B ` | ` ByteData ` |
91- | ` array[int8] ` | ` [$i ` | ` Int8List ` |
92- | ` array[uint8] ` | ` [$U ` | ` Uint8List ` |
93- | ` array[int16] ` | ` [$u ` | ` Int16List ` |
94- | ` array[uint16] ` | ` [$I ` | ` Uint16List ` |
95- | ` array[int32] ` | ` [$l ` | ` Int32List ` |
96- | ` array[uint32] ` | ` [$m ` | ` Uint32List ` |
97- | ` array[int64] ` | ` [$L ` | ` Int64List ` |
98- | ` array[uint64] ` | ` [$M ` | ` Uint64List ` |
99- | ` array[float16] ` | ` [$h ` | ` Float32List ` |
100- | ` array[float32] ` | ` [$d ` | ` Float32List ` |
101- | ` array[float64] ` | ` [$D ` | ` Float64List ` |
102- | ` object ` | ` {} ` | ` Map ` |
103-
104- \* Warning: ` int ` in Dart is a signed 64-bit integer. ` uint64 ` /` M ` values are decoded as ` int64 `
69+ | BJData Type | Marker | Dart |
70+ | ------------------| --------| --------------------------------|
71+ | ` null ` | ` Z ` | ` null ` |
72+ | ` true ` | ` T ` | ` true ` |
73+ | ` false ` | ` F ` | ` false ` |
74+ | ` int8 ` | ` i ` | ` int ` |
75+ | ` uint8 ` | ` U ` | ` int ` |
76+ | ` int16 ` | ` u ` | ` int ` |
77+ | ` uint16 ` | ` I ` | ` int ` |
78+ | ` int32 ` | ` l ` | ` int ` |
79+ | ` uint32 ` | ` m ` | ` int ` |
80+ | ` int64 ` | ` L ` | ` int ` |
81+ | ` uint64 ` | ` M ` | ` int ` [ * ] ( #decode-int-warning ) |
82+ | ` float16 ` | ` h ` | ` double ` |
83+ | ` float32 ` | ` d ` | ` double ` |
84+ | ` float64 ` | ` D ` | ` double ` |
85+ | ` byte ` | ` B ` | ` int ` |
86+ | ` char ` | ` C ` | ` String ` |
87+ | ` string ` | ` S ` | ` String ` |
88+ | ` huge ` | ` H ` | ` BigInt ` |
89+ | ` array ` | ` [] ` | ` List ` |
90+ | ` array[byte] ` | ` [$B ` | ` ByteData ` |
91+ | ` array[int8] ` | ` [$i ` | ` Int8List ` |
92+ | ` array[uint8] ` | ` [$U ` | ` Uint8List ` |
93+ | ` array[int16] ` | ` [$u ` | ` Int16List ` |
94+ | ` array[uint16] ` | ` [$I ` | ` Uint16List ` |
95+ | ` array[int32] ` | ` [$l ` | ` Int32List ` |
96+ | ` array[uint32] ` | ` [$m ` | ` Uint32List ` |
97+ | ` array[int64] ` | ` [$L ` | ` Int64List ` |
98+ | ` array[uint64] ` | ` [$M ` | ` Uint64List ` |
99+ | ` array[float16] ` | ` [$h ` | ` Float32List ` |
100+ | ` array[float32] ` | ` [$d ` | ` Float32List ` |
101+ | ` array[float64] ` | ` [$D ` | ` Float64List ` |
102+ | ` object ` | ` {} ` | ` Map ` |
103+
104+ <a name =" decode-int-warning " >\* </a >
105+ Warning: ` int ` in Dart is a signed 64-bit integer. ` uint64 ` /` M ` values are decoded as ` int64 `
105106 (i.e. values greater than ` 9223372036854775807 ` are decoded as negative values).
106107
107108### Encoding Dart to BJData
108- | Dart | Marker | BJData Type |
109- | ---------------| -----------| ------------------|
110- | ` null ` | ` Z ` | ` null ` |
111- | ` bool ` | ` TF ` | ` bool ` |
112- | ` int ` | ` UiIumlL ` | ` int ` * |
113- | ` double ` | ` D ` | ` float64 ` |
114- | ` String ` | ` S ` | ` string ` |
115- | ` BigInt ` | ` H ` | ` huge ` |
116- | ` List ` | ` [] ` | ` array ` |
117- | ` ByteData ` | ` [$B ` | ` array[byte] ` ** |
118- | ` Int8List ` | ` [$i ` | ` array[int8] ` |
119- | ` Uint8List ` | ` [$U ` | ` array[uint8] ` |
120- | ` Int16List ` | ` [$u ` | ` array[int16] ` |
121- | ` Uint16List ` | ` [$I ` | ` array[uint16] ` |
122- | ` Int32List ` | ` [$l ` | ` array[int32] ` |
123- | ` Uint32List ` | ` [$m ` | ` array[uint32] ` |
124- | ` Int64List ` | ` [$L ` | ` array[int64] ` |
125- | ` Uint64List ` | ` [$M ` | ` array[uint64] ` |
126- | ` Float32List ` | ` [$d ` | ` array[float32] ` |
127- | ` Float64List ` | ` [$D ` | ` array[float64] ` |
128- | ` Map ` | ` {} ` | ` object ` |
129-
130- \* ` int ` values are encoded using the smallest integer type possible, favouring unsigned types.
131-
132- \* * ` ByteData ` is recommended for encoding "binary data" as per the BJData specification
109+ | Dart | Marker | BJData Type |
110+ | ---------------| -----------| ------------------------------------------------|
111+ | ` null ` | ` Z ` | ` null ` |
112+ | ` bool ` | ` TF ` | ` bool ` |
113+ | ` int ` | ` UiIumlL ` | ` int ` [ * ] ( #encode-int-notice ) |
114+ | ` double ` | ` D ` | ` float64 ` |
115+ | ` String ` | ` S ` | ` string ` |
116+ | ` BigInt ` | ` H ` | ` huge ` |
117+ | ` List ` | ` [] ` | ` array ` |
118+ | ` ByteData ` | ` [$B ` | ` array[byte] ` [ ** ] ( #encode-binary-data-notice ) |
119+ | ` Int8List ` | ` [$i ` | ` array[int8] ` |
120+ | ` Uint8List ` | ` [$U ` | ` array[uint8] ` |
121+ | ` Int16List ` | ` [$u ` | ` array[int16] ` |
122+ | ` Uint16List ` | ` [$I ` | ` array[uint16] ` |
123+ | ` Int32List ` | ` [$l ` | ` array[int32] ` |
124+ | ` Uint32List ` | ` [$m ` | ` array[uint32] ` |
125+ | ` Int64List ` | ` [$L ` | ` array[int64] ` |
126+ | ` Uint64List ` | ` [$M ` | ` array[uint64] ` |
127+ | ` Float32List ` | ` [$d ` | ` array[float32] ` |
128+ | ` Float64List ` | ` [$D ` | ` array[float64] ` |
129+ | ` Map ` | ` {} ` | ` object ` |
130+
131+ <a name =" encode-int-notice " >\* </a >
132+ ` int ` values are encoded using the smallest integer type possible, favouring unsigned types.
133+
134+ <a name =" encode-binary-data-notice " >\* * </a > ` ByteData ` is recommended for encoding "binary data" as per the BJData specification
133135 (as this may affect how the data is parsed in other libraries). Converting from ` Uint8List `
134136 to ` ByteData ` can be done using ` ByteData.sublistView(list) ` .
135137
136- ### Web
138+ ## Web
137139The package can be used in web applications, however it is affected by the [ JavaScript number
138140peculiarities] ( https://dart.dev/resources/language/number-representation#differences-in-behavior ) .
139141
0 commit comments