Javascript DataView setInt32()

Introduction

The Javascript DataView setInt32() method stores a signed 32-bit integer value at the specified offset to the DataView.

dataview.setInt32(byteOffset, value [, littleEndian])
  • byteOffset - the offset, in byte, from the start of the view.
  • value - the value to set.
  • littleEndian - Optional, boolean value. If false or undefined, a big-endian value is written. Otherwise use the little endian.

Using the setInt32 method

var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
dataview.setInt32(1, 3);/*from  w w w  .  ja  v  a 2  s .  co  m*/
let a = dataview.getInt32(1);
console.log(a); // 3



PreviousNext

Related