msgpack_dart
msgpack_dart copied to clipboard
Make offset available publicly in Decoder
trafficstars
I think that if the offset was available publicly I could parse messages that have become concatenated on a stream like:
[1, 2, 3][4, 5, 6]
By using the offset to split the original byte array. Otherwise I can't think of a sensible way of parsing that. If you are ok with that, and the concept is correct, I am happy to make a PR. For now I will just copy-paste and modify the code.
I mean Deserializer, sorry.
I've just tested and it works fine, quick hack example once _offset is offset
List<dynamic> deserializeMany(List<int> data) {
final d = Deserializer(data);
final List<dynamic> results = [];
var keepDecoding = true;
while (keepDecoding) {
results.add(d.decode());
keepDecoding = d.offset < data.length;
}
return results;
}