Packagecom.smartfoxserver.v2.entities.data
Interfacepublic interface ISFSObject
Implementors SFSObject

The ISFSObject interface defines all the public methods and properties of the SFSObject class used by SmartFoxServer in client-server data transfer. Read the implementor class description for additional informations.

NOTE: where mentioned in the "See also" section of the members descriptions below, check the SFSDataType class for more informations on data types conversion in ActionScript 3.

See also

SFSObject
SFSDataType


Public Methods
 MethodDefined By
  
containsKey(key:String):Boolean
Indicates whether this object contains a mapping for the specified key or not.
ISFSObject
  
getBool(key:String):Boolean
Returns the element corresponding to the specified key as a boolean.
ISFSObject
  
getBoolArray(key:String):Array
Returns the element corresponding to the specified key as an array of booleans.
ISFSObject
  
getByte(key:String):int
Returns the element corresponding to the specified key as a signed byte (8 bit).
ISFSObject
  
getByteArray(key:String):ByteArray
Returns the element corresponding to the specified key as an array of bytes.
ISFSObject
  
getClass(key:String):*
Returns the element corresponding to the specified key as an instance of a custom class.
ISFSObject
  
getDouble(key:String):Number
Returns the element corresponding to the specified key as a double precision number.
ISFSObject
  
getDoubleArray(key:String):Array
Returns the element corresponding to the specified key as an array of double precision numbers.
ISFSObject
  
getDump(format:Boolean = true):String
Provides a formatted string representing this object.
ISFSObject
  
getFloat(key:String):Number
Returns the element corresponding to the specified key as a floating point number.
ISFSObject
  
getFloatArray(key:String):Array
Returns the element corresponding to the specified key as an array of floating point numbers.
ISFSObject
  
getHexDump():String
Provides a detailed hexadecimal representation of this object.
ISFSObject
  
getInt(key:String):int
Returns the element corresponding to the specified key as an integer (32 bit).
ISFSObject
  
getIntArray(key:String):Array
Returns the element corresponding to the specified key as an array of integers.
ISFSObject
  
getKeys():Array
Retrieves a list of all the keys contained in this object.
ISFSObject
  
getLong(key:String):Number
Returns the element corresponding to the specified key as a long integer (64 bit).
ISFSObject
  
getLongArray(key:String):Array
Returns the element corresponding to the specified key as an array of long integers.
ISFSObject
  
Returns the element corresponding to the specified key as an ISFSArray object.
ISFSObject
  
Returns the element corresponding to the specified key as an ISFSObject object.
ISFSObject
  
getShort(key:String):int
Returns the element corresponding to the specified key as a short integer (16 bit).
ISFSObject
  
getShortArray(key:String):Array
Returns the element corresponding to the specified key as an array of short integers.
ISFSObject
  
getText(key:String):String
Returns the element corresponding to the specified key as a UTF-8 string, with max length of 2 GBytes.
ISFSObject
  
getUnsignedByte(key:String):int
Returns the element corresponding to the specified key as an unsigned byte (8 bit).
ISFSObject
  
getUnsignedByteArray(key:String):Array
Returns the element corresponding to the specified key as an array of unsigned bytes.
ISFSObject
  
getUtfString(key:String):String
Returns the element corresponding to the specified key as a UTF-8 string, with max length of 32 KBytes.
ISFSObject
  
getUtfStringArray(key:String):Array
Returns the element corresponding to the specified key as an array of UTF-8 strings.
ISFSObject
  
isNull(key:String):Boolean
Indicates if the value mapped by the specified key is null.
ISFSObject
  
putBool(key:String, value:Boolean):void
Associates the passed boolean value with the specified key in this object.
ISFSObject
  
putBoolArray(key:String, value:Array):void
Associates the passed array of boolean values with the specified key in this object.
ISFSObject
  
putByte(key:String, value:int):void
Associates the passed byte (8 bit) value with the specified key in this object.
ISFSObject
  
putByteArray(key:String, value:ByteArray):void
Associates the passed array of bytes with the specified key in this object.
ISFSObject
  
putClass(key:String, value:*):void
Associates the passed custom class instance with the specified key in this object.
ISFSObject
  
putDouble(key:String, value:Number):void
Associates the passed double precision number (64 bit) value with the specified key in this object.
ISFSObject
  
putDoubleArray(key:String, value:Array):void
Associates the passed array of double precision number values with the specified key in this object.
ISFSObject
  
putFloat(key:String, value:Number):void
Associates the passed floating point number (32 bit) value with the specified key in this object.
ISFSObject
  
putFloatArray(key:String, value:Array):void
Associates the passed array of floating point number values with the specified key in this object.
ISFSObject
  
putInt(key:String, value:int):void
Associates the passed integer (32 bit) value with the specified key in this object.
ISFSObject
  
putIntArray(key:String, value:Array):void
Associates the passed array of integer values with the specified key in this object.
ISFSObject
  
putLong(key:String, value:Number):void
Associates the passed long integer (64 bit) value with the specified key in this object.
ISFSObject
  
putLongArray(key:String, value:Array):void
Associates the passed array of long integer values with the specified key in this object.
ISFSObject
  
putSFSArray(key:String, value:ISFSArray):void
Associates the passed ISFSArray object with the specified key in this object.
ISFSObject
  
putSFSObject(key:String, value:ISFSObject):void
Associates the passed ISFSObject object with the specified key in this object.
ISFSObject
  
putShort(key:String, value:int):void
Associates the passed short integer (16 bit) value with the specified key in this object.
ISFSObject
  
putShortArray(key:String, value:Array):void
Associates the passed array of short integer values with the specified key in this object.
ISFSObject
  
putText(key:String, value:String):void
Associates the passed UTF-8 string value (max length: 2 GBytes) with the specified key in this object.
ISFSObject
  
putUtfString(key:String, value:String):void
Associates the passed UTF-8 string value (max length: 32 KBytes) with the specified key in this object.
ISFSObject
  
putUtfStringArray(key:String, value:Array):void
Associates the passed array of UTF-8 string values with the specified key in this object.
ISFSObject
  
removeElement(key:String):void
Removes the element corresponding to the passed key from this object.
ISFSObject
  
size():int
Indicates the number of elements in this object.
ISFSObject
  
toBinary():ByteArray
Provides the binary form of this object.
ISFSObject
  
toObject():Object
Converts the SFSObject to a regular AS Object.
ISFSObject
Method Detail
containsKey()method
public function containsKey(key:String):Boolean

Indicates whether this object contains a mapping for the specified key or not.

Parameters

key:String — The key whose presence in this object is to be tested.

Returns
Booleantrue if this object contains a mapping for the specified key.
getBool()method 
public function getBool(key:String):Boolean

Returns the element corresponding to the specified key as a boolean.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Boolean — The element of this object associated with the specified key.
getBoolArray()method 
public function getBoolArray(key:String):Array

Returns the element corresponding to the specified key as an array of booleans.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of Boolean values.
getByte()method 
public function getByte(key:String):int

Returns the element corresponding to the specified key as a signed byte (8 bit).

Parameters

key:String — The key whose associated value is to be returned.

Returns
int — The element of this object associated with the specified key.

See also

getByteArray()method 
public function getByteArray(key:String):ByteArray

Returns the element corresponding to the specified key as an array of bytes.

Parameters

key:String — The key whose associated value is to be returned.

Returns
ByteArray — The element of this object as a ByteArray.
getClass()method 
public function getClass(key:String):*

Returns the element corresponding to the specified key 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

key:String — The key whose associated value is to be returned.

Returns
* — The element of this object as a generic Object type to be casted to the target class definition.

Example
The following example shows the same class on the client and server sides, which can be transferred back and forth with the getClass() and putClass() methods. The server-side Java definition of a SpaceShip class is:
         
         package my.game.spacecombat
         
         public class SpaceShip implements SerializableSFSType
         {
             private String type;
             private String name;
             private int firePower;
             private int maxSpeed;
             private List<String> weapons;
             
             public SpaceShip(String name, String type)
             {
                 this.name = name;
                 this.type = type;
             }
             
             // Getters/Setters
             
             ...
         }
         
The client-side ActionScript 3 definition of the SpaceShip class is:
         
         package my.game.spacecombat
         
         public class SpaceShip implements SerializableSFSType
         {
             private var _type:String;
             private var _name:String;
             private var _firePower:int;
             private var _maxSpeed:int;
             private var _weapons:Array;
             
             public function SpaceShip(name:String, type:String)
             {
                 _name = name;
                 _type = type;
             }
             
             // Getters/Setters
             
             ...
         }
         
The SpaceShip instance is sent by the server to the client. This is how to retrieve it:
         
         var key:String = "spaceShip";
         var myShipData:SpaceShip = sfsObject.getClass(key) as SpaceShip;
         
getDouble()method 
public function getDouble(key:String):Number

Returns the element corresponding to the specified key as a double precision number.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Number — The element of this object associated with the specified key.

See also

getDoubleArray()method 
public function getDoubleArray(key:String):Array

Returns the element corresponding to the specified key as an array of double precision numbers.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of Number values.

See also

getDump()method 
public function getDump(format:Boolean = true):String

Provides a formatted string representing this object. 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.

Returns
String — The string representation of this object.
getFloat()method 
public function getFloat(key:String):Number

Returns the element corresponding to the specified key as a floating point number.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Number — The element of this object associated with the specified key.

See also

getFloatArray()method 
public function getFloatArray(key:String):Array

Returns the element corresponding to the specified key as an array of floating point numbers.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of Number values.

See also

getHexDump()method 
public function getHexDump():String

Provides a detailed hexadecimal representation of this object. The returned string can be logged or traced in the console for debugging purposes.

Returns
String — The hexadecimal string representation of this object.
getInt()method 
public function getInt(key:String):int

Returns the element corresponding to the specified key as an integer (32 bit).

Parameters

key:String — The key whose associated value is to be returned.

Returns
int — The element of this object associated with the specified key.
getIntArray()method 
public function getIntArray(key:String):Array

Returns the element corresponding to the specified key as an array of integers.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of int values.
getKeys()method 
public function getKeys():Array

Retrieves a list of all the keys contained in this object.

Returns
Array — The list of all the keys in this object.
getLong()method 
public function getLong(key:String):Number

Returns the element corresponding to the specified key as a long integer (64 bit).

Parameters

key:String — The key whose associated value is to be returned.

Returns
Number — The element of this object associated with the specified key.

See also

getLongArray()method 
public function getLongArray(key:String):Array

Returns the element corresponding to the specified key as an array of long integers.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of Number values.

See also

getSFSArray()method 
public function getSFSArray(key:String):ISFSArray

Returns the element corresponding to the specified key as an ISFSArray object.

Parameters

key:String — The key whose associated value is to be returned.

Returns
ISFSArray — The element of this object as an object implementing the ISFSArray interface.
getSFSObject()method 
public function getSFSObject(key:String):ISFSObject

Returns the element corresponding to the specified key as an ISFSObject object.

Parameters

key:String — The key whose associated value is to be returned.

Returns
ISFSObject — The element of this object as an object implementing the ISFSObject interface.
getShort()method 
public function getShort(key:String):int

Returns the element corresponding to the specified key as a short integer (16 bit).

Parameters

key:String — The key whose associated value is to be returned.

Returns
int — The element of this object associated with the specified key.

See also

getShortArray()method 
public function getShortArray(key:String):Array

Returns the element corresponding to the specified key as an array of short integers.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of int values.

See also

getText()method 
public function getText(key:String):String

Returns the element corresponding to the specified key as a UTF-8 string, with max length of 2 GBytes.

Parameters

key:String — The key whose associated value is to be returned.

Returns
String — The element of this object associated with the specified key.
getUnsignedByte()method 
public function getUnsignedByte(key:String):int

Returns the element corresponding to the specified key as an unsigned byte (8 bit).

Parameters

key:String — The key whose associated value is to be returned.

Returns
int — The element of this object associated with the specified key.

See also

getUnsignedByteArray()method 
public function getUnsignedByteArray(key:String):Array

Returns the element corresponding to the specified key as an array of unsigned bytes.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of int values.

See also

getUtfString()method 
public function getUtfString(key:String):String

Returns the element corresponding to the specified key as a UTF-8 string, with max length of 32 KBytes.

Parameters

key:String — The key whose associated value is to be returned.

Returns
String — The element of this object associated with the specified key.
getUtfStringArray()method 
public function getUtfStringArray(key:String):Array

Returns the element corresponding to the specified key as an array of UTF-8 strings.

Parameters

key:String — The key whose associated value is to be returned.

Returns
Array — The element of this object as an array of String values.
isNull()method 
public function isNull(key:String):Boolean

Indicates if the value mapped by the specified key is null.

Parameters

key:String — The key to be checked.

Returns
Booleantrue if the value mapped by the passed key is null.
putBool()method 
public function putBool(key:String, value:Boolean):void

Associates the passed boolean value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:Boolean — The value to be associated with the specified key.

putBoolArray()method 
public function putBoolArray(key:String, value:Array):void

Associates the passed array of boolean values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of Boolean values to be associated with the specified key.

putByte()method 
public function putByte(key:String, value:int):void

Associates the passed byte (8 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:int — The value to be associated with the specified key.

See also

putByteArray()method 
public function putByteArray(key:String, value:ByteArray):void

Associates the passed array of bytes with the specified key in this object.

Parameters

key:String — The key with which the specified ByteArray is to be associated.
 
value:ByteArray — The ByteArray to be associated with the specified key.

putClass()method 
public function putClass(key:String, value:*):void

Associates the passed custom class instance with the specified key in this object. Read the getClass() method description for more informations.

Parameters

key:String — The key with which the specified custom class instance is to be associated.
 
value:* — The custom class instance to be associated with the specified key.

See also

putDouble()method 
public function putDouble(key:String, value:Number):void

Associates the passed double precision number (64 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:Number — The value to be associated with the specified key.

See also

putDoubleArray()method 
public function putDoubleArray(key:String, value:Array):void

Associates the passed array of double precision number values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of Number values to be associated with the specified key.

See also

putFloat()method 
public function putFloat(key:String, value:Number):void

Associates the passed floating point number (32 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:Number — The value to be associated with the specified key.

See also

putFloatArray()method 
public function putFloatArray(key:String, value:Array):void

Associates the passed array of floating point number values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of Number values to be associated with the specified key.

See also

putInt()method 
public function putInt(key:String, value:int):void

Associates the passed integer (32 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:int — The value to be associated with the specified key.

putIntArray()method 
public function putIntArray(key:String, value:Array):void

Associates the passed array of integer values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of int values to be associated with the specified key.

putLong()method 
public function putLong(key:String, value:Number):void

Associates the passed long integer (64 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:Number — The value to be associated with the specified key.

See also

putLongArray()method 
public function putLongArray(key:String, value:Array):void

Associates the passed array of long integer values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of Number values to be associated with the specified key.

See also

putSFSArray()method 
public function putSFSArray(key:String, value:ISFSArray):void

Associates the passed ISFSArray object with the specified key in this object.

Parameters

key:String — The key with which the specified object implementing the ISFSArray interface is to be associated.
 
value:ISFSArray — The ISFSArray object to be associated with the specified key.

putSFSObject()method 
public function putSFSObject(key:String, value:ISFSObject):void

Associates the passed ISFSObject object with the specified key in this object.

Parameters

key:String — The key with which the specified object implementing the ISFSObject interface is to be associated.
 
value:ISFSObject — The ISFSObject object to be associated with the specified key.

putShort()method 
public function putShort(key:String, value:int):void

Associates the passed short integer (16 bit) value with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:int — The value to be associated with the specified key.

See also

putShortArray()method 
public function putShortArray(key:String, value:Array):void

Associates the passed array of short integer values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of int values to be associated with the specified key.

See also

putText()method 
public function putText(key:String, value:String):void

Associates the passed UTF-8 string value (max length: 2 GBytes) with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:String — The value to be associated with the specified key.

putUtfString()method 
public function putUtfString(key:String, value:String):void

Associates the passed UTF-8 string value (max length: 32 KBytes) with the specified key in this object.

Parameters

key:String — The key with which the specified value is to be associated.
 
value:String — The value to be associated with the specified key.

putUtfStringArray()method 
public function putUtfStringArray(key:String, value:Array):void

Associates the passed array of UTF-8 string values with the specified key in this object.

Parameters

key:String — The key with which the specified array is to be associated.
 
value:Array — The array of String values to be associated with the specified key.

removeElement()method 
public function removeElement(key:String):void

Removes the element corresponding to the passed key from this object.

Parameters

key:String — The key of the element to be removed.

size()method 
public function size():int

Indicates the number of elements in this object.

Returns
int — The number of elements in this object.
toBinary()method 
public function toBinary():ByteArray

Provides the binary form of this object.

Returns
ByteArray — The binary data representing this object.
toObject()method 
public function toObject():Object

Converts the SFSObject to a regular AS Object.

Returns
Object — The object.