No Description

NodeBufferReader.js 519B

12345678910111213141516171819
  1. 'use strict';
  2. var Uint8ArrayReader = require('./Uint8ArrayReader');
  3. var utils = require('../utils');
  4. function NodeBufferReader(data) {
  5. Uint8ArrayReader.call(this, data);
  6. }
  7. utils.inherits(NodeBufferReader, Uint8ArrayReader);
  8. /**
  9. * @see DataReader.readData
  10. */
  11. NodeBufferReader.prototype.readData = function(size) {
  12. this.checkOffset(size);
  13. var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
  14. this.index += size;
  15. return result;
  16. };
  17. module.exports = NodeBufferReader;