सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक पोर्टेबल डार्ट पैकेज जो कुशल डेटा सीरियलाइज़ेशन और डीसीरियलाइज़ेशन के लिए है, जिसमें बाइनरी डेटा के निम्न-स्तरीय पढ़ने और लिखने के लिए डायनामिक BytesBuffer शामिल है। ऑब्जेक्ट्स और सीरियलाइज़्ड फॉर्मेट के बीच रूपांतरण को सरल बनाने के लिए डिज़ाइन किया गया है, यह एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स पर क्रॉस-प्लेटफॉर्म उपयोग के लिए समर्थन करता है। न्यूनतम ओवरहेड के साथ उच्च प्रदर्शन वाले डेटा हैंडलिंग की आवश्यकता वाले एप्लिकेशन के लिए आदर्श है। नेटवर्क संचार, फ़ाइल स्टोरेज या रियल-टाइम डेटा एक्सचेंज जैसे परिदृश्यों में इसका उपयोग विशेष रूप से उपयोगी है जहाँ गति और विश्वसनीयता महत्वपूर्ण है।
उपयोग
बाइनरी डेटा ट्रांसमिशन
फ़ाइल प्रारूप विश्लेषण
रियल-टाइम डेटा प्रोसेसिंग
प्लेटफॉर्म के बीच डेटा साझाकरण
नेटवर्क प्रोटोकॉल कार्यान्वयन
मुख्य विशेषताएँ
गतिशील BytesBuffer
कुशल अनुक्रमण
क्रॉस-प्लेटफ़ॉर्म समर्थन
निम्न स्तर का डेटा हेरफेर
उच्च प्रदर्शन
इनके लिए उपयुक्त
उच्च प्रदर्शन वाले एप्लिकेशन
नेटवर्क-भारी एप्लिकेशन
एम्बेडेड सिस्टम
डेटा-गहन वर्कफ्लो
कस्टम बाइनरी फॉर्मेट
विचार योग्य बातें
बाइनरी डेटा के बारे में समझ की आवश्यकता है
केवल मूलभूत प्रकार तक सीमित, कस्टम लॉजिक के बिना
जटिल JSON संरचनाओं के लिए आदर्श नहीं है
हाथ से प्रकार प्रबंधन की आवश्यकता है
निम्न स्तरीय संचालन के लिए सीखने का वक्र
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
data_serializer
Portable Dart package to handle data serialization/deserialization efficiently,
including a dynamic BytesBuffer to read/write data.
API Documentation
See the API Documentation for a full list of functions, classes and extension.
Usage
import'package:data_serializer/data_serializer.dart';
voidmain() {
// Dynamic bytes buffer with initial capacity of 16 bytes.var buffer = BytesBuffer(16);
// Write a unsigned int of 32 bits:
buffer.writeInt32(0x10203040);
// Write a `String` encoded using UTF-8:
buffer.writeString('Hello!');
// Write a unsigned int of 64 bits:
buffer.writeUint64(9223372036854775807);
// Write a data block (prefixed by 4 bytes for he data length).var dataBlock = [110, 120, 130, 140, 150, 160].toUint8List();
buffer.writeBlock32(dataBlock);
// Write all bytes:
buffer.writeAll([210, 220]);
// The current length of the buffer, expanded automatically:print('length: ${buffer.length}');
// Change the current position cursor to `0`:
buffer.seek(0);
// Read a 32 bits int:var n32 = buffer.readUint32();
print('n32: 0x${n32.toHex32()}');
// Reads a `String` decoding from UTF-8:var s = buffer.readString();
print('s: $s');
// Read a 64 bits int:var n64 = buffer.readUint64();
print('n64: $n64');
// The current buffer position:print('position: ${buffer.position}');
// Read a data block:var dataBlock2 = buffer.readBlock32();
print('dataBlock2: $dataBlock2');
// The position after read the data block:print('position: ${buffer.position}');
// The remaining bytes in the buffer:var tailBytes = buffer.readRemainingBytes();
print('tailBytes: $tailBytes');
}
All the operations are tested to be compatible with JavaScript.
Note that JS only supports 53-bits integers. To avoid any issue serializing 64-bits integers,
try to use BigInt serialization, or ensure that you are bellow the 53-bits range.
See the class DataSerializerPlatform if you need runtime information
about integers support.
Test Coverage
This package aims to always have a high test coverage percentage, over 95%.
With that the package can be a reliable tool to support your important projects.