Created
April 28, 2011 18:56
-
-
Save donthorp/947031 to your computer and use it in GitHub Desktop.
Codec Numeric Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Encode a 4 byte integer into position 10 using BIG_ENDIAN encoding | |
var buffer = Ti.createBuffer({ length: 100 }); | |
Ti.Codec.encodeNumber({ | |
source: 0x3456789a, | |
dest: buffer, | |
position: 10, | |
type: Ti.Codec.TYPE_INT, | |
byteOrder: Ti.Codec.BIG_ENDIAN | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Decode a 4 byte integer from position 10 using BIG_ENDIAN encoding | |
var value = Ti.Codec.decodeNumber({ | |
source: buffer, | |
position: 10, | |
type: Ti.Codec.TYPE_INT, | |
byteOrder: Ti.Codec.BIG_ENDIAN | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment