// Supplemental read functions. /** * Read a big-endian word. * @param {UInt} nOffset - The offset in the file. * @returns {UShort} The word value. * @alias Binary.readBEWord */ File.readBEWord = function(nOffset) { return (File.readByte(nOffset) << 8) + File.readByte(nOffset+1); } /** * Read a big-endian dword. * @param {UInt} nOffset - The offset in the file. * @returns {UInt} The dword value. * @alias Binary.readBEDword */ File.readBEDword = function(nOffset) { return File.swapBytes(File.readDword(nOffset)); } /** * Read a word, selecting endianness. * @param {UInt} nOffset - The offset in the file. * @param {Bool} bBE - True for big-endian. * @returns {UShort} The word value. * @alias Binary.readEWord */ File.readEWord = function(nOffset,bBE) { return bBE?File.readBEWord(nOffset):File.readWord(nOffset); } /** * Read a dword, selecting endianness. * @param {UInt} nOffset - The offset in the file. * @param {Bool} bBE - True for big-endian. * @returns {UInt} The dword value. * @alias Binary.readEDWord */ File.readEDword = function(nOffset,bBE) { return bBE?File.readBEDword(nOffset):File.readDword(nOffset); } /** * Read a short (signed 16-bit) value. * @param {UInt} nOffset - The offset in the file. * @returns {Short} The short value. * @alias Binary.readShort */ File.readShort = function(nOffset) { return (File.readWord(nOffset)<<16)>>16; }