ac3118b601176682c1e392cafa6cb4e73d45a906347aa573e6f7cc6c3e7b790b.json 5.7 KB

1
  1. {"ast":null,"code":"import { Decode } from \"./stringTools.js\";\n/**\n * Utility class for reading from a data buffer\n */\nexport class DataReader {\n /**\n * Constructor\n * @param buffer The buffer to read\n */\n constructor(buffer) {\n /**\n * The current byte offset from the beginning of the data buffer.\n */\n this.byteOffset = 0;\n this.buffer = buffer;\n }\n /**\n * Loads the given byte length.\n * @param byteLength The byte length to load\n * @returns A promise that resolves when the load is complete\n */\n loadAsync(byteLength) {\n return this.buffer.readAsync(this.byteOffset, byteLength).then(data => {\n this._dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\n this._dataByteOffset = 0;\n });\n }\n /**\n * Read a unsigned 32-bit integer from the currently loaded data range.\n * @returns The 32-bit integer read\n */\n readUint32() {\n const value = this._dataView.getUint32(this._dataByteOffset, true);\n this._dataByteOffset += 4;\n this.byteOffset += 4;\n return value;\n }\n /**\n * Read a byte array from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The byte array read\n */\n readUint8Array(byteLength) {\n const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._dataByteOffset, byteLength);\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n return value;\n }\n /**\n * Read a string from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The string read\n */\n readString(byteLength) {\n return Decode(this.readUint8Array(byteLength));\n }\n /**\n * Skips the given byte length the currently loaded data range.\n * @param byteLength The byte length to skip\n */\n skipBytes(byteLength) {\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n }\n}","map":{"version":3,"names":["Decode","DataReader","constructor","buffer","byteOffset","loadAsync","byteLength","readAsync","then","data","_dataView","DataView","_dataByteOffset","readUint32","value","getUint32","readUint8Array","Uint8Array","readString","skipBytes"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Misc/dataReader.js"],"sourcesContent":["import { Decode } from \"./stringTools.js\";\n/**\n * Utility class for reading from a data buffer\n */\nexport class DataReader {\n /**\n * Constructor\n * @param buffer The buffer to read\n */\n constructor(buffer) {\n /**\n * The current byte offset from the beginning of the data buffer.\n */\n this.byteOffset = 0;\n this.buffer = buffer;\n }\n /**\n * Loads the given byte length.\n * @param byteLength The byte length to load\n * @returns A promise that resolves when the load is complete\n */\n loadAsync(byteLength) {\n return this.buffer.readAsync(this.byteOffset, byteLength).then((data) => {\n this._dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\n this._dataByteOffset = 0;\n });\n }\n /**\n * Read a unsigned 32-bit integer from the currently loaded data range.\n * @returns The 32-bit integer read\n */\n readUint32() {\n const value = this._dataView.getUint32(this._dataByteOffset, true);\n this._dataByteOffset += 4;\n this.byteOffset += 4;\n return value;\n }\n /**\n * Read a byte array from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The byte array read\n */\n readUint8Array(byteLength) {\n const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._dataByteOffset, byteLength);\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n return value;\n }\n /**\n * Read a string from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The string read\n */\n readString(byteLength) {\n return Decode(this.readUint8Array(byteLength));\n }\n /**\n * Skips the given byte length the currently loaded data range.\n * @param byteLength The byte length to skip\n */\n skipBytes(byteLength) {\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,kBAAkB;AACzC;AACA;AACA;AACA,OAAO,MAAMC,UAAU,CAAC;EACpB;AACJ;AACA;AACA;EACIC,WAAWA,CAACC,MAAM,EAAE;IAChB;AACR;AACA;IACQ,IAAI,CAACC,UAAU,GAAG,CAAC;IACnB,IAAI,CAACD,MAAM,GAAGA,MAAM;EACxB;EACA;AACJ;AACA;AACA;AACA;EACIE,SAASA,CAACC,UAAU,EAAE;IAClB,OAAO,IAAI,CAACH,MAAM,CAACI,SAAS,CAAC,IAAI,CAACH,UAAU,EAAEE,UAAU,CAAC,CAACE,IAAI,CAAEC,IAAI,IAAK;MACrE,IAAI,CAACC,SAAS,GAAG,IAAIC,QAAQ,CAACF,IAAI,CAACN,MAAM,EAAEM,IAAI,CAACL,UAAU,EAAEK,IAAI,CAACH,UAAU,CAAC;MAC5E,IAAI,CAACM,eAAe,GAAG,CAAC;IAC5B,CAAC,CAAC;EACN;EACA;AACJ;AACA;AACA;EACIC,UAAUA,CAAA,EAAG;IACT,MAAMC,KAAK,GAAG,IAAI,CAACJ,SAAS,CAACK,SAAS,CAAC,IAAI,CAACH,eAAe,EAAE,IAAI,CAAC;IAClE,IAAI,CAACA,eAAe,IAAI,CAAC;IACzB,IAAI,CAACR,UAAU,IAAI,CAAC;IACpB,OAAOU,KAAK;EAChB;EACA;AACJ;AACA;AACA;AACA;EACIE,cAAcA,CAACV,UAAU,EAAE;IACvB,MAAMQ,KAAK,GAAG,IAAIG,UAAU,CAAC,IAAI,CAACP,SAAS,CAACP,MAAM,EAAE,IAAI,CAACO,SAAS,CAACN,UAAU,GAAG,IAAI,CAACQ,eAAe,EAAEN,UAAU,CAAC;IACjH,IAAI,CAACM,eAAe,IAAIN,UAAU;IAClC,IAAI,CAACF,UAAU,IAAIE,UAAU;IAC7B,OAAOQ,KAAK;EAChB;EACA;AACJ;AACA;AACA;AACA;EACII,UAAUA,CAACZ,UAAU,EAAE;IACnB,OAAON,MAAM,CAAC,IAAI,CAACgB,cAAc,CAACV,UAAU,CAAC,CAAC;EAClD;EACA;AACJ;AACA;AACA;EACIa,SAASA,CAACb,UAAU,EAAE;IAClB,IAAI,CAACM,eAAe,IAAIN,UAAU;IAClC,IAAI,CAACF,UAAU,IAAIE,UAAU;EACjC;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}