BinaryData QML Type

Provides means to write to and edit binary string arrays. More...

Import Statement: import ArcGIS.AppFramework 1.0

Properties

Methods

Detailed Description

Enumerations

Type enumeration

NameValue
BinaryData.TypeInt322
BinaryData.TypeUInt323
BinaryData.TypeInt644
BinaryData.TypeUInt645
BinaryData.TypeDouble6
BinaryData.TypeInt1633
BinaryData.TypeInt834
BinaryData.TypeUInt1636
BinaryData.TypeUInt837
BinaryData.TypeSingle38

ByteOrder enumeration

NameValue
BinaryData.BigEndian0
BinaryData.LittleEndian1
BinaryData.PlatformByteOrder1

TextEncoding enumeration

This enum describes the text that binary will be encoded into by the stringData() and setStringData() functions.

NameValue
BinaryData.TextEncodingUnknown-1
BinaryData.TextEncodingUtf80
BinaryData.TextEncodingLatin11
BinaryData.TextEncodingLocal8Bit2
BinaryData.TextEncodingUtf163

Property Documentation

base64 : string

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"

data : object

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

hex : string


[read-only] isEmpty : bool

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

[read-only] isNull : bool

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

size : int

Returns the number of bytes in the byte array.

var s = "Hello";
var b = AppFramework.binaryData(s);
console.log(b.size); // returns 5

textEncoding : TextEncoding

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

clear()

Clears the contents of the byte array, making it empty.


var dataAt(int offset)

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.


var dataAt(int offset, type type)

The offset parameter

The type parameter


var dataAt(int offset, type type, byteorder byteOrder)

The offset parameter

The type parameter

The byteOrder parameter

See also setDataAt().


fill(int byteValue)

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.


fill(int byteValue, int size)

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.


int setDataAt(int index, var value)

The index parameter

The value parameter


int setDataAt(int index, var value, type type)

The index parameter

The value parameter

The type parameter


int setDataAt(int index, var value, type type, byteorder byteOrder)

The index parameter

The value parameter

The type parameter

The byteOrder parameter

See also dataAt().


setStringData(string string)

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.


setStringData(string string, textencoding encoding)

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().


string stringData()

Returns the string currently stored in the binary object.


string stringData(textencoding encoding)

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().


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.