Files
WebODF/webodf/lib/core/ByteArray.js
T

37 lines
903 B
JavaScript
Raw Normal View History

2010-11-09 10:44:27 +01:00
/*global core*/
2010-11-04 00:18:56 +01:00
/*jslint plusplus: false, bitwise: false */
/**
2010-11-04 00:18:56 +01:00
* @constructor
* @param {!string} data
*/
core.ByteArray = function ByteArray(data) {
2010-11-04 00:18:56 +01:00
/**
* @type {!number}
*/
this.pos = 0;
/**
* @type {!string}
*/
this.data = data;
/**
* @return {number}
*/
this.readUInt32LE = function () {
var data = this.data,
pos = (this.pos += 4);
return ((data.charCodeAt(--pos) & 0xFF) << 24) |
((data.charCodeAt(--pos) & 0xFF) << 16) |
((data.charCodeAt(--pos) & 0xFF) << 8) |
(data.charCodeAt(--pos) & 0xFF);
};
/**
* @return {number}
*/
this.readUInt16LE = function () {
var data = this.data,
pos = (this.pos += 2);
return ((data.charCodeAt(--pos) & 0xFF) << 8) |
(data.charCodeAt(--pos) & 0xFF);
};
};