MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / deserialize

Method deserialize

projects/JavaScript/proto/test.js:17908–17921  ·  view source on GitHub ↗

* Deserialize the struct value * @this {!StructListModel} * @param {!StructList} value StructList value, defaults is new StructList() * @return {!object} Deserialized StructList value and its size

(value = new StructList())

Source from the content-addressed store, hash-verified

17906 * @return {!object} Deserialized StructList value and its size
17907 */
17908 deserialize (value = new StructList()) {
17909 if ((this.buffer.offset + this.model.fbeOffset - 4) > this.buffer.size) {
17910 return { value: new StructList(), size: 0 }
17911 }
17912
17913 let fbeFullSize = this.readUInt32(this.model.fbeOffset - 4)
17914 console.assert((fbeFullSize >= this.model.fbeSize), 'Model is broken!')
17915 if (fbeFullSize < this.model.fbeSize) {
17916 return { value: new StructList(), size: 0 }
17917 }
17918
17919 this.model.get(value)
17920 return { value: value, size: fbeFullSize }
17921 }
17922
17923 /**
17924 * Move to the next struct value

Callers 1

cloneMethod · 0.95

Calls 2

readUInt32Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected