Provides means to write to and edit binary string arrays. More...
Import Statement: | import ArcGIS.AppFramework 1.0 |
Properties
- base64 : string
- data : object
- hex : string
- isEmpty : bool
- isNull : bool
- size : int
- textEncoding : TextEncoding
Methods
- clear()
- var dataAt(int offset)
- var dataAt(int offset, type type)
- var dataAt(int offset, type type, byteorder byteOrder)
- fill(int byteValue)
- fill(int byteValue, int size)
- int setDataAt(int index, var value)
- int setDataAt(int index, var value, type type)
- int setDataAt(int index, var value, type type, byteorder byteOrder)
- setStringData(string string)
- setStringData(string string, textencoding encoding)
- string stringData()
- string stringData(textencoding encoding)
Detailed Description
Enumerations
Type enumeration
Name | Value |
---|---|
BinaryData.TypeInt32 | 2 |
BinaryData.TypeUInt32 | 3 |
BinaryData.TypeInt64 | 4 |
BinaryData.TypeUInt64 | 5 |
BinaryData.TypeDouble | 6 |
BinaryData.TypeInt16 | 33 |
BinaryData.TypeInt8 | 34 |
BinaryData.TypeUInt16 | 36 |
BinaryData.TypeUInt8 | 37 |
BinaryData.TypeSingle | 38 |
ByteOrder enumeration
Name | Value |
---|---|
BinaryData.BigEndian | 0 |
BinaryData.LittleEndian | 1 |
BinaryData.PlatformByteOrder | 1 |
TextEncoding enumeration
This enum describes the text that binary will be encoded into by the stringData() and setStringData() functions.
Name | Value |
---|---|
BinaryData.TextEncodingUnknown | -1 |
BinaryData.TextEncodingUtf8 | 0 |
BinaryData.TextEncodingLatin1 | 1 |
BinaryData.TextEncodingLocal8Bit | 2 |
BinaryData.TextEncodingUtf16 | 3 |
Property Documentation
Allows data to be set from a base64 encoded string, or returned as a base64 encoded string.
var b = AppFramework.binaryData(); // produces a binary data object b.base64 = "QXBwU3R1ZGlvIGZvciBBcmNHSVM="; console.log(b.stringData()); // returns "ArcGIS AppStudio"
Returns a pointer to the data stored in the array.
var s = "Hello"; var b = AppFramework.binaryData(s); // produces a binary data object console.log(b.data); // returns "Hello" object
Returns true if the array has size 0. Otherwise, returns false.
b.clear(); console.log(b.isNull, b.isEmpty); // returns true to both isNull and isEmpty
Returns true if the array is null. Otherwise, returns false.
b.clear(); console.log(b.isNull, b.isEmpty); // returns true to both isNull and isEmpty
Returns the number of bytes in the byte array.
var s = "Hello"; var b = AppFramework.binaryData(s); console.log(b.size); // returns 5
Returns the form of text encoding currently being used.
console.log(b.textEncoding); // returns 0, which is the value for BinaryData.TextEncodingUtf8 enum
Method Documentation
Returns the ASCII character in the array at the given index position. If successful, returns true; if the index location does not exist, returns false.
var s = "Hello"; var b = AppFramework.binaryData(s); // Get data at index 0 console.log(b.dataAt(0)); // returns 72 which is the ASCII value for symbol "H"
The offset parameter
The index position in the byte array.
Sets every byte in the array to the defined character.
var s = "Hello"; var b = AppFramework.binaryData(s); // produces a binary data object b.fill(72); // ASCII value for "H" symbol console.log(b.data); // returns "HHHHH"
The byteValue parameter
The character to set every value in the array to.
Resizes the array to the given size, then sets every byte in the array to the defined character.
The byteValue parameter
The character to set every byte in the array to.
The size parameter
The size you're resizing the byte array to.
The index parameter
The value parameter
The type parameter
The index parameter
The value parameter
The type parameter
The byteOrder parameter
See also dataAt().
Sets the binary object's contents to the defined string.
For example,
var s = "Hello"; var b = AppFramework.binaryData(s); // produces a binary data object b.size; // returns 5 b.setStringData("ArcGIS AppStudio"); // a 20-character string b.size; // returns 20
The string parameter
The string of data being written to the binary object.
Sets the binary object's contents to the defined string, with the specified form of encoding.
The string parameter
The string of data being written to the binary object.
The encoding parameter
The form of encoding the string will be encoded as.
See also stringData().
Returns the string currently stored in the binary object, applying the defined form of text encoding.
The encoding parameter
The form of text encoding to apply to the string.
See also setStringData().