| Package | com.smartfoxserver.v2.entities.data |
| Class | public class SFSArray |
| Inheritance | SFSArray Object |
| Implements | ISFSArray |
The advantage of using the SFSArray class (for example as a nested object inside a SFSObject object) is that you can fine tune the way your data is transmitted over the network.
For instance, when transmitting a list of numbers between 0 and 100, those values can be treated as normal integers (which take 32 bits each), but also as shorts (16 bit) or even as bytes (8 bit).
SFSArray supports many primitive data types and related arrays of primitives (see the SFSDataType class). It also allows to serialize class instances and rebuild them on the other side (client or server). Check the SmartFoxServer 2X documentation for more informations on this advanced topic.
See also
| Method | Defined By | ||
|---|---|---|---|
SFSArray()
Creates a new SFSArray instance. | SFSArray | ||
addBool(value:Boolean):void
Appends a boolean value to the end of this array. | SFSArray | ||
addBoolArray(value:Array):void
Appends an array of boolean values to the end of this array. | SFSArray | ||
addByte(value:int):void
Appends a byte (8 bit) value to the end of this array. | SFSArray | ||
addByteArray(value:ByteArray):void
Appends an array of bytes to the end of this array. | SFSArray | ||
addClass(value:*):void
Appends the passed custom class instance to the end of this array. | SFSArray | ||
addDouble(value:Number):void
Appends a double precision number (64 bit) value to the end of this array. | SFSArray | ||
addDoubleArray(value:Array):void
Appends an array of double precision number values to the end of this array. | SFSArray | ||
addFloat(value:Number):void
Appends a floating point number (32 bit) value to the end of this array. | SFSArray | ||
addFloatArray(value:Array):void
Appends an array of floating point number values to the end of this array. | SFSArray | ||
addInt(value:int):void
Appends an integer (32 bit) value to the end of this array. | SFSArray | ||
addIntArray(value:Array):void
Appends an array of integer values to the end of this array. | SFSArray | ||
addLong(value:Number):void
Appends a long integer (64 bit) value to the end of this array. | SFSArray | ||
addLongArray(value:Array):void
Appends an array of long integer values to the end of this array. | SFSArray | ||
addNull():void
Appends a null value to the end of this array. | SFSArray | ||
addSFSArray(value:ISFSArray):void
Appends a ISFSArray object to the end of this array. | SFSArray | ||
addSFSObject(value:ISFSObject):void
Appends a ISFSObject object to the end of this array. | SFSArray | ||
addShort(value:int):void
Appends a short integer (16 bit) value to the end of this array. | SFSArray | ||
addShortArray(value:Array):void
Appends an array of short integer values to the end of this array. | SFSArray | ||
addText(value:String):void
Appends a UTF-8 string (with max length of 2 GBytes) to the end of this array. | SFSArray | ||
addUtfString(value:String):void
Appends a UTF-8 string (with max length of 32 KBytes) to the end of this array. | SFSArray | ||
addUtfStringArray(value:Array):void
Appends an array of UTF-8 string values to the end of this array. | SFSArray | ||
contains(obj:*):Boolean
Indicates whether this array contains the specified object or not. | SFSArray | ||
getBool(index:int):Boolean
Returns the element at the specified position as a boolean. | SFSArray | ||
getBoolArray(index:int):Array
Returns the element at the specified position as an array of booleans. | SFSArray | ||
getByte(index:int):int
Returns the element at the specified position as a signed byte (8 bit). | SFSArray | ||
getByteArray(index:int):ByteArray
Returns the element at the specified position as an array of bytes. | SFSArray | ||
getClass(index:int):*
Returns the element at the specified position as an instance of a custom class. | SFSArray | ||
getDouble(index:int):Number
Returns the element at the specified position as a double precision number. | SFSArray | ||
getDoubleArray(index:int):Array
Returns the element at the specified position as an array of double precision numbers. | SFSArray | ||
getDump(format:Boolean = true):String
Provides a formatted string representing this array. | SFSArray | ||
getElementAt(index:int):*
Returns the element at the specified position in this array. | SFSArray | ||
getFloat(index:int):Number
Returns the element at the specified position as a floating point number. | SFSArray | ||
getFloatArray(index:int):Array
Returns the element at the specified position as an array of floating point numbers. | SFSArray | ||
getHexDump():String
Provides a detailed hexadecimal representation of this array. | SFSArray | ||
getInt(index:int):int
Returns the element at the specified position as an integer (32 bit). | SFSArray | ||
getIntArray(index:int):Array
Returns the element at the specified position as an array of integers. | SFSArray | ||
getLong(index:int):Number
Returns the element at the specified position as a long integer (64 bit). | SFSArray | ||
getLongArray(index:int):Array
Returns the element at the specified position as an array of long integers. | SFSArray | ||
getSFSArray(index:int):ISFSArray
Returns the element at the specified position as an ISFSArray object. | SFSArray | ||
getSFSObject(index:int):ISFSObject
Returns the element at the specified position as an ISFSObject object. | SFSArray | ||
getShort(index:int):int
Returns the element at the specified position as a short integer (16 bit). | SFSArray | ||
getShortArray(index:int):Array
Returns the element at the specified position as an array of short integers. | SFSArray | ||
getText(index:int):String
Returns the element at the specified position as a UTF-8 string, with max length of 2 Gbytes. | SFSArray | ||
getUnsignedByte(index:int):int
Returns the element at the specified position as an unsigned byte (8 bit). | SFSArray | ||
getUnsignedByteArray(index:int):Array
Returns the element at the specified position as an array of unsigned bytes. | SFSArray | ||
getUtfString(index:int):String
Returns the element at the specified position as a UTF-8 string, with max length of 32 KBytes. | SFSArray | ||
getUtfStringArray(index:int):Array
Returns the element at the specified position as an array of UTF-8 strings. | SFSArray | ||
isNull(index:int):Boolean
Indicates if the element at the specified position in this array is null. | SFSArray | ||
newFromArray(arr:Array, forceToNumber:Boolean = false):SFSArray [static]
Returns a new SFSArray instance. | SFSArray | ||
[static]
Returns a new SFSArray instance. | SFSArray | ||
removeElementAt(index:int):*
Removes the element at the specified position in this array. | SFSArray | ||
size():int
Indicates the number of elements in this array. | SFSArray | ||
toArray():Array
Converts the SFSArray to a native Actionscript Array. | SFSArray | ||
toBinary():ByteArray
Provides the binary form of this array. | SFSArray | ||
| SFSArray | () | Constructor |
| addBool | () | method |
public function addBool(value:Boolean):voidAppends a boolean value to the end of this array.
Parameters
value:Boolean — The value to be appended to this array.
|
| addBoolArray | () | method |
public function addBoolArray(value:Array):voidAppends an array of boolean values to the end of this array.
Parameters
value:Array — The array of Boolean values to be appended to this array.
|
| addByte | () | method |
public function addByte(value:int):voidAppends a byte (8 bit) value to the end of this array.
Parameters
value:int — The value to be appended to this array.
|
| addByteArray | () | method |
public function addByteArray(value:ByteArray):voidAppends an array of bytes to the end of this array.
Parameters
value:ByteArray — The array of int values to be appended to this array.
|
| addClass | () | method |
public function addClass(value:*):voidAppends the passed custom class instance to the end of this array. Read the getClass() method description for more informations.
Parameters
value:* — The custom class instance to be appended to this array.
|
| addDouble | () | method |
public function addDouble(value:Number):voidAppends a double precision number (64 bit) value to the end of this array.
Parameters
value:Number — The value to be appended to this array.
|
| addDoubleArray | () | method |
public function addDoubleArray(value:Array):voidAppends an array of double precision number values to the end of this array.
Parameters
value:Array — The array of Number values to be appended to this array.
|
| addFloat | () | method |
public function addFloat(value:Number):voidAppends a floating point number (32 bit) value to the end of this array.
Parameters
value:Number — The value to be appended to this array.
|
| addFloatArray | () | method |
public function addFloatArray(value:Array):voidAppends an array of floating point number values to the end of this array.
Parameters
value:Array — The array of Number values to be appended to this array.
|
| addInt | () | method |
public function addInt(value:int):voidAppends an integer (32 bit) value to the end of this array.
Parameters
value:int — The value to be appended to this array.
|
| addIntArray | () | method |
public function addIntArray(value:Array):voidAppends an array of integer values to the end of this array.
Parameters
value:Array — The array of int values to be appended to this array.
|
| addLong | () | method |
public function addLong(value:Number):voidAppends a long integer (64 bit) value to the end of this array.
Parameters
value:Number — The value to be appended to this array.
|
| addLongArray | () | method |
public function addLongArray(value:Array):voidAppends an array of long integer values to the end of this array.
Parameters
value:Array — The array of Number values to be appended to this array.
|
| addNull | () | method |
public function addNull():void
Appends a null value to the end of this array.
| addSFSArray | () | method |
public function addSFSArray(value:ISFSArray):voidAppends a ISFSArray object to the end of this array.
Parameters
value:ISFSArray — The object implementing the ISFSArray interface to be appended to this array.
|
| addSFSObject | () | method |
public function addSFSObject(value:ISFSObject):voidAppends a ISFSObject object to the end of this array.
Parameters
value:ISFSObject — The object implementing the ISFSObject interface to be appended to this array.
|
| addShort | () | method |
public function addShort(value:int):voidAppends a short integer (16 bit) value to the end of this array.
Parameters
value:int — The value to be appended to this array.
|
| addShortArray | () | method |
public function addShortArray(value:Array):voidAppends an array of short integer values to the end of this array.
Parameters
value:Array — The array of int values to be appended to this array.
|
| addText | () | method |
public function addText(value:String):voidAppends a UTF-8 string (with max length of 2 GBytes) to the end of this array.
Parameters
value:String — The value to be appended to this array.
|
| addUtfString | () | method |
public function addUtfString(value:String):voidAppends a UTF-8 string (with max length of 32 KBytes) to the end of this array.
Parameters
value:String — The value to be appended to this array.
|
| addUtfStringArray | () | method |
public function addUtfStringArray(value:Array):voidAppends an array of UTF-8 string values to the end of this array.
Parameters
value:Array — The array of String values to be appended to this array.
|
| contains | () | method |
public function contains(obj:*):BooleanIndicates whether this array contains the specified object or not.
Parameters
obj:* — The object whose presence in this array is to be tested.
|
Boolean — true if the specified object is present.
|
| getBool | () | method |
public function getBool(index:int):BooleanReturns the element at the specified position as a boolean.
Parameters
index:int — The position of the element to return.
|
Boolean — The element of this array at the specified index.
|
| getBoolArray | () | method |
public function getBoolArray(index:int):ArrayReturns the element at the specified position as an array of booleans.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of Boolean values.
|
| getByte | () | method |
public function getByte(index:int):intReturns the element at the specified position as a signed byte (8 bit).
Parameters
index:int — The position of the element to return.
|
int — The element of this array at the specified index.
|
| getByteArray | () | method |
public function getByteArray(index:int):ByteArrayReturns the element at the specified position as an array of bytes.
Parameters
index:int — The position of the element to return.
|
ByteArray — The element of this array as a ByteArray.
|
| getClass | () | method |
public function getClass(index:int):*Returns the element at the specified position as an instance of a custom class.
This advanced feature allows the transmission of specific object instances between client-side ActionScript and server-side Java provided that the respective class definitions on both sides have the same package name and they implement the SerializableSFSType interface.
Parameters
index:int — The position of the element to return.
|
* — The element of this array as a generic Object type to be casted to the target class definition.
|
| getDouble | () | method |
public function getDouble(index:int):NumberReturns the element at the specified position as a double precision number.
Parameters
index:int — The position of the element to return.
|
Number — The element of this array at the specified index.
|
| getDoubleArray | () | method |
public function getDoubleArray(index:int):ArrayReturns the element at the specified position as an array of double precision numbers.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of Number values.
|
| getDump | () | method |
public function getDump(format:Boolean = true):StringProvides a formatted string representing this array. The returned string can be logged or traced in the console for debugging purposes.
Parameters
format:Boolean (default = true) — If true, the output is formatted in a human-readable way.
|
String — The string representation of this array.
|
| getElementAt | () | method |
public function getElementAt(index:int):*Returns the element at the specified position in this array.
Parameters
index:int — The position of the element to return.
|
* — The element at the specified index in this array.
|
| getFloat | () | method |
public function getFloat(index:int):NumberReturns the element at the specified position as a floating point number.
Parameters
index:int — The position of the element to return.
|
Number — The element of this array at the specified index.
|
| getFloatArray | () | method |
public function getFloatArray(index:int):ArrayReturns the element at the specified position as an array of floating point numbers.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of Number values.
|
| getHexDump | () | method |
public function getHexDump():StringProvides a detailed hexadecimal representation of this array. The returned string can be logged or traced in the console for debugging purposes.
ReturnsString — The hexadecimal string representation of this array.
|
| getInt | () | method |
public function getInt(index:int):intReturns the element at the specified position as an integer (32 bit).
Parameters
index:int — The position of the element to return.
|
int — The element of this array at the specified index.
|
| getIntArray | () | method |
public function getIntArray(index:int):ArrayReturns the element at the specified position as an array of integers.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of int values.
|
| getLong | () | method |
public function getLong(index:int):NumberReturns the element at the specified position as a long integer (64 bit).
Parameters
index:int — The position of the element to return.
|
Number — The element of this array at the specified index.
|
| getLongArray | () | method |
public function getLongArray(index:int):ArrayReturns the element at the specified position as an array of long integers.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of Number values.
|
| getSFSArray | () | method |
public function getSFSArray(index:int):ISFSArrayReturns the element at the specified position as an ISFSArray object.
Parameters
index:int — The position of the element to return.
|
ISFSArray — The element of this array as an object implementing the ISFSArray interface.
|
| getSFSObject | () | method |
public function getSFSObject(index:int):ISFSObjectReturns the element at the specified position as an ISFSObject object.
Parameters
index:int — The position of the element to return.
|
ISFSObject — The element of this array as an object implementing the ISFSObject interface.
|
| getShort | () | method |
public function getShort(index:int):intReturns the element at the specified position as a short integer (16 bit).
Parameters
index:int — The position of the element to return.
|
int — The element of this array at the specified index.
|
| getShortArray | () | method |
public function getShortArray(index:int):ArrayReturns the element at the specified position as an array of short integers.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of int values.
|
| getText | () | method |
public function getText(index:int):StringReturns the element at the specified position as a UTF-8 string, with max length of 2 Gbytes.
Parameters
index:int — The position of the element to return.
|
String — The element of this array at the specified index.
|
| getUnsignedByte | () | method |
public function getUnsignedByte(index:int):intReturns the element at the specified position as an unsigned byte (8 bit).
Parameters
index:int — The position of the element to return.
|
int — The element of this array at the specified index.
|
| getUnsignedByteArray | () | method |
public function getUnsignedByteArray(index:int):ArrayReturns the element at the specified position as an array of unsigned bytes.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of int values.
|
| getUtfString | () | method |
public function getUtfString(index:int):StringReturns the element at the specified position as a UTF-8 string, with max length of 32 KBytes.
Parameters
index:int — The position of the element to return.
|
String — The element of this array at the specified index.
|
| getUtfStringArray | () | method |
public function getUtfStringArray(index:int):ArrayReturns the element at the specified position as an array of UTF-8 strings.
Parameters
index:int — The position of the element to return.
|
Array — The element of this array as an array of String values.
|
| isNull | () | method |
public function isNull(index:int):Boolean
Indicates if the element at the specified position in this array is null.
Parameters
index:int — The position of the element to be checked.
|
Boolean — true if the element of this array at the specified position is null.
|
| newFromArray | () | method |
public static function newFromArray(arr:Array, forceToNumber:Boolean = false):SFSArrayReturns a new SFSArray instance.
This is an alternative static constructor that builds a SFSArray populated with the data found in the passed native ActionScript Array.
Numeric data is translated to int (integer values) or Number (decimal values). The procedure is recursive and works for nested objects and arrays.
The supported native types are: Boolean, int, Number, String, Object, Array. The array can contain null values too.
Parameters
arr:Array — The source Array.
| |
forceToNumber:Boolean (default = false) — Indicates if the conversion of all numeric values should be forced to the highest precision possible (Number). This means that integer values will be treated as double precision values.
|
SFSArray — A new SFSArray instance populated with data from the passed array.
|
See also
| newInstance | () | method |
public static function newInstance():SFSArrayReturns a new SFSArray instance. This method is an alternative to the standard class constructor.
ReturnsSFSArray — A new SFSArray instance.
|
See also
| removeElementAt | () | method |
public function removeElementAt(index:int):*Removes the element at the specified position in this array.
Parameters
index:int — The position of the element to be removed.
|
* — The element that was removed.
|
| size | () | method |
public function size():intIndicates the number of elements in this array.
Returnsint — The number of elements in this array.
|
| toArray | () | method |
public function toArray():ArrayConverts the SFSArray to a native Actionscript Array. The procedure is recurisive so all nested objects will also be converted. The process does not include elements of type SFSDataType.CLASS
ReturnsArray — The converted Array
|
See also
| toBinary | () | method |
public function toBinary():ByteArrayProvides the binary form of this array.
ReturnsByteArray — The binary data representing this array.
|