Titanium.Codec.decodeNumber

Function of Titanium.Codec.
Platform Since
Android 1.7
iPhone 1.7
iPad 1.7

Summary

Decodes the source buffer (starting at the optional position) using the passed in data type. Throws an Exception if source is null, or position is greater than source.length

Code Examples

Decode an 8 byte double-precision floating point number

Decode an 8 byte double-precision floating point number using the OS byte order

var buffer = //...
var value = Ti.Codec.decodeNumber({
    source: buffer,
    type: Ti.Codec.TYPE_DOUBLE
});

Decode a 4 byte integer from position 10 using BIG_ENDIAN encoding

var buffer = //...
var value = Ti.Codec.decodeNumber({
      source: buffer,
      position: 10,
      type: Ti.Codec.TYPE_INT,
      byteOrder: Ti.Codec.BIG_ENDIAN
});

Arguments

Name Type Summary
options Dictionary<DecodeNumberDict>

decodeNumber named options

Return Type

Number