2010-11-09 10:44:27 +01:00
|
|
|
/*global core*/
|
2010-11-04 00:18:56 +01:00
|
|
|
/*jslint plusplus: false, bitwise: false */
|
2010-06-08 00:32:28 +02:00
|
|
|
/**
|
2010-11-04 00:18:56 +01:00
|
|
|
* @constructor
|
|
|
|
|
* @param {!string} data
|
2010-06-08 00:32:28 +02:00
|
|
|
*/
|
2010-11-09 13:36:51 +01:00
|
|
|
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);
|
2011-02-14 09:40:08 +01:00
|
|
|
return ((data.charCodeAt(--pos) & 0xFF) << 24) |
|
|
|
|
|
((data.charCodeAt(--pos) & 0xFF) << 16) |
|
|
|
|
|
((data.charCodeAt(--pos) & 0xFF) << 8) |
|
|
|
|
|
(data.charCodeAt(--pos) & 0xFF);
|
2010-11-04 00:18:56 +01:00
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* @return {number}
|
|
|
|
|
*/
|
|
|
|
|
this.readUInt16LE = function () {
|
|
|
|
|
var data = this.data,
|
|
|
|
|
pos = (this.pos += 2);
|
|
|
|
|
return ((data.charCodeAt(--pos) & 0xFF) << 8) |
|
2011-02-14 09:40:08 +01:00
|
|
|
(data.charCodeAt(--pos) & 0xFF);
|
2010-11-04 00:18:56 +01:00
|
|
|
};
|
2010-06-08 00:32:28 +02:00
|
|
|
};
|