1 /** 2 * Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> 3 * 4 * @licstart 5 * This file is part of WebODF. 6 * 7 * WebODF is free software: you can redistribute it and/or modify it 8 * under the terms of the GNU Affero General Public License (GNU AGPL) 9 * as published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 11 * 12 * WebODF is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Affero General Public License for more details. 16 * 17 * You should have received a copy of the GNU Affero General Public License 18 * along with WebODF. If not, see <http://www.gnu.org/licenses/>. 19 * @licend 20 * 21 * @source: http://www.webodf.org/ 22 * @source: https://github.com/kogmbh/WebODF/ 23 */ 24 25 /*global core*/ 26 /*jslint plusplus: true, bitwise: true */ 27 28 /** 29 * @constructor 30 * @param {!Uint8Array} data 31 */ 32 core.ByteArray = function ByteArray(data) { 33 "use strict"; 34 /** 35 * @type {!number} 36 */ 37 this.pos = 0; 38 /** 39 * @type {!Uint8Array} 40 */ 41 this.data = data; 42 /** 43 * @return {number} 44 */ 45 this.readUInt32LE = function () { 46 this.pos += 4; 47 var d = this.data, 48 pos = this.pos; 49 return (d[--pos] << 24) | 50 (d[--pos] << 16) | 51 (d[--pos] << 8) | 52 d[--pos]; 53 }; 54 /** 55 * @return {number} 56 */ 57 this.readUInt16LE = function () { 58 this.pos += 2; 59 var d = this.data, 60 pos = this.pos; 61 return (d[--pos] << 8) | d[--pos]; 62 }; 63 }; 64