var StringUtils = require('./stringutils');
/**
* @constructor
*/
function BinaryFile(strData, iDataOffset, iDataLength) {
var data = strData;
var dataOffset = iDataOffset || 0;
var dataLength = 0;
this.getRawData = function() {
return data;
};
if (typeof strData == "string") {
dataLength = iDataLength || data.length;
this.getByteAt = function(iOffset) {
return data.charCodeAt(iOffset + dataOffset) & 0xFF;
};
} else if (typeof strData == "unknown") {
dataLength = iDataLength || IEBinary_getLength(data);
this.getByteAt = function(iOffset) {
return IEBinary_getByteAt(data, iOffset + dataOffset);
};
}
// @aadsm
this.getBytesAt = function(iOffset, iLength) {
var bytes = new Array(iLength);
for( var i = 0; i < iLength; i++ ) {
bytes[i] = this.getByteAt(iOffset+i);
}
return bytes;
};
this.getLength = function() {
return dataLength;
};
// @aadsm
this.isBitSetAt = function(iOffset, iBit) {
var iByte = this.getByteAt(iOffset);
return (iByte & (1 127)
return iByte - 256;
else
return iByte;
};
this.getShortAt = function(iOffset, bBigEndian) {
var iShort = bBigEndian ?
(this.getByteAt(iOffset)