Skip to content


Ingvar Stepanyan edited this page Aug 27, 2013 · 2 revisions

jDataView has bitfield support for I/O operations on numbers with non-standard bit length. Such numbers are widely used in different popular binary formats, especially in those that are used for data compression or storing multimedia information.

Those methods allow to use bitLength <= 32 bits. Don't forget to manually ensure byte padding before reading non-bitfield values after calling those methods (if you implement some standard popular format, it's most likely already done for you).

  • getSigned(bitLength, byteOffset)
  • setSigned(byteOffset, value, bitLength)
  • writeSigned(value, bitLength)
  • getUnsigned(bitLength, byteOffset)
  • setUnsigned(byteOffset, value, bitLength)
  • writeUnsigned(value, bitLength)