Package com.smartfoxserver.entities.data
Interface ISFSArray
- All Known Implementing Classes:
SFSArray
public interface ISFSArray
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SFSDataWrapper wrappedObject) voidaddBool(boolean value) Add a booleanvoidaddBoolArray(Collection<Boolean> value) Add an collection of booleanvoidaddByte(byte value) Add a byte (signed 8-bit)voidaddByteArray(byte[] value) Add an array of bytesvoidaddDouble(double value) Add a byte (signed decimal 64-bit)voidaddDoubleArray(Collection<Double> value) Add a collection of doublevoidaddFloat(float value) Add a byte (signed decimal 32-bit)voidaddFloatArray(Collection<Float> value) Add a collection of floatvoidaddInt(int value) Add a byte (signed 32-bit)voidaddIntArray(Collection<Integer> value) Add a collection of intvoidaddLong(long value) Add a byte (signed 64-bit)voidaddLongArray(Collection<Long> value) Add a collection of longvoidaddNull()Add a null field to the Object.voidaddSFSArray(ISFSArray value) Add a nested ISFSArrayvoidaddSFSObject(ISFSObject value) Add a nested ISFSObjectvoidaddShort(short value) Add a byte (signed 16-bit)voidaddShortArray(Collection<Short> value) Add a collection of shortvoidaddShortString(String value) Add a UTF encoded string with max length of 255 bytesvoidaddShortStringArray(Collection<String> value) Add a collection of UTF encoded strings, each string limited to a max of 255 bytes The collection is also limited to a max of 32768 elementsvoidAdd a UTF encoded string with max length of 32768 bytesvoidaddStringArray(Collection<String> value) Add a collection of UTF encoded strings, each string limited to a max of 32768 bytes The collection is also limited to a max of 32768 elementsvoidAdd a UTF encoded long String with max length of 2 GBytesvoidaddVector2(SFSVector2 value) Add a SFSVector2 (2x float 32bit)voidaddVector2Array(Collection<SFSVector2> value) Add a collection of SFSVector2voidaddVector3(SFSVector3 value) Add a SFSVector3 (3x float 32bit)voidaddVector3Array(Collection<SFSVector3> value) Add a collection of SFSVector3booleanChecks if a specific element is contained in the arrayget(int index) getBool(int index) Get the element at the specified index as Boolean.getBoolArray(int index) Get the element at the specified index as Collection of Boolean.getByte(int index) Get the element at the specified index as Byte.byte[]getByteArray(int index) Get the element at the specified index as byte array.getDouble(int index) Get the element at the specified index as Double.getDoubleArray(int index) Get the element at the specified index as Collection of Double.getDump()Get a detailed dump of the SFSArray structuregetDump(boolean noFormat) Get a detailed dump of the SFSArray structuregetElementAt(int index) getFloat(int index) Get the element at the specified index as Float.getFloatArray(int index) Get the element at the specified index as Collection of Float.Get a pretty-printed hex-dump of the arraygetInt(int index) Get the element at the specified index as Integer.getIntArray(int index) Get the element at the specified index as Collection of Int.getLong(int index) Get the element at the specified index as Long.getLongArray(int index) Get the element at the specified index as Collection of Long.getSFSArray(int index) Get the element at the specified index as ISFSArray.getSFSObject(int index) Get the element at the specified index as ISFSObject.getShort(int index) Get the element at the specified index as Short.getShortArray(int index) Get the element at the specified index as Collection of Short.getShortString(int index) Get the element at the specified index as short string, with a max length of 255 bytes It can be null if no element exists for the specified indexgetShortStringArray(int index) Get the element at the specified index as Collection of String.getString(int index) Get the element at the specified index as string, with a max length of 32768 bytes It can be null if no element exists for the specified indexgetStringArray(int index) Get the element at the specified index as Collection of String.getText(int index) Get the element at the specified index as long String, with a max length of 2 GBytes.getUnsignedByte(int index) Get the element at the specified index as an unsigned Integer (bytes are always signed, -127 < b < 127)
It can be null if no element exists for the specified indexgetUnsignedByteArray(int index) Get the element at the specified index as a Collection of unsigned integers.getVector2(int index) Get the element at the specified index as SFSVector2.getVector2Array(int index) Get the element at the specified index as Collection of SFSVector2.getVector3(int index) Get the element at the specified index as SFSVector3.getVector3Array(int index) Get the element at the specified index as Collection of SFSVector3.booleanisNull(int index) Checks if a specific element is null.iterator()voidremoveElementAt(int index) Remove an element at a specific indexintsize()Return the number of elements contained in the arraybyte[]toBinary()Return the binary representation of the SFSArraytoJson()Return the JSON representation of the SFSArray
-
Method Details
-
contains
Checks if a specific element is contained in the array- Parameters:
obj- the object- Returns:
- true if the object exists
-
iterator
Iterator<SFSDataWrapper> iterator() -
getElementAt
-
get
-
removeElementAt
void removeElementAt(int index) Remove an element at a specific index- Parameters:
index- the index of the element to remove
-
size
int size()Return the number of elements contained in the array- Returns:
- the number of elements contained in the array
-
toBinary
byte[] toBinary()Return the binary representation of the SFSArray- Returns:
- the binary representation of the SFSArray
-
toJson
String toJson()Return the JSON representation of the SFSArray- Returns:
- the JSON representation of the SFSArray
-
getHexDump
String getHexDump()Get a pretty-printed hex-dump of the array- Returns:
- a pretty-printed hex-dump of the array
-
getDump
String getDump()Get a detailed dump of the SFSArray structure- Returns:
- a detailed dump of the SFSArray structure
-
getDump
Get a detailed dump of the SFSArray structure- Parameters:
noFormat- if true the dump will not be pretty-printed- Returns:
- a detailed dump of the SFSArray structure
-
addNull
void addNull()Add a null field to the Object. Normally we recommend that null values are simply not sent. On the other end of the application you can simply check if a specific key exists or not, to detect a null.This method will effectively add the key and a byte id to describe the Null value, thus "bloating" the message
-
addBool
void addBool(boolean value) Add a boolean- Parameters:
value-
-
addByte
void addByte(byte value) Add a byte (signed 8-bit)- Parameters:
value-
-
addShort
void addShort(short value) Add a byte (signed 16-bit)- Parameters:
value-
-
addInt
void addInt(int value) Add a byte (signed 32-bit)- Parameters:
value-
-
addLong
void addLong(long value) Add a byte (signed 64-bit)- Parameters:
value-
-
addFloat
void addFloat(float value) Add a byte (signed decimal 32-bit)- Parameters:
value-
-
addDouble
void addDouble(double value) Add a byte (signed decimal 64-bit)- Parameters:
value-
-
addString
Add a UTF encoded string with max length of 32768 bytes- Parameters:
value-
-
addShortString
Add a UTF encoded string with max length of 255 bytes- Parameters:
value-
-
addText
Add a UTF encoded long String with max length of 2 GBytes- Parameters:
value-
-
addVector2
Add a SFSVector2 (2x float 32bit)- Parameters:
value-
-
addVector3
Add a SFSVector3 (3x float 32bit)- Parameters:
value-
-
addBoolArray
Add an collection of boolean- Parameters:
value-
-
addByteArray
void addByteArray(byte[] value) Add an array of bytesNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- Parameters:
value-
-
addShortArray
Add a collection of short- Parameters:
value-
-
addIntArray
Add a collection of int- Parameters:
value-
-
addLongArray
Add a collection of long- Parameters:
value-
-
addFloatArray
Add a collection of float- Parameters:
value-
-
addDoubleArray
Add a collection of double- Parameters:
value-
-
addStringArray
Add a collection of UTF encoded strings, each string limited to a max of 32768 bytes The collection is also limited to a max of 32768 elements- Parameters:
value-
-
addShortStringArray
Add a collection of UTF encoded strings, each string limited to a max of 255 bytes The collection is also limited to a max of 32768 elements- Parameters:
value-
-
addVector2Array
Add a collection of SFSVector2- Parameters:
value-
-
addVector3Array
Add a collection of SFSVector3- Parameters:
value-
-
addSFSArray
Add a nested ISFSArray- Parameters:
value-
-
addSFSObject
Add a nested ISFSObject- Parameters:
value-
-
add
-
isNull
boolean isNull(int index) Checks if a specific element is null.- Parameters:
index- the index of the element in the array- Returns:
- true if the item is null
-
getBool
Get the element at the specified index as Boolean. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getByte
Get the element at the specified index as Byte. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getUnsignedByte
Get the element at the specified index as an unsigned Integer (bytes are always signed, -127 < b < 127)
It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getShort
Get the element at the specified index as Short. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getInt
Get the element at the specified index as Integer. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getLong
Get the element at the specified index as Long. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getFloat
Get the element at the specified index as Float. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getDouble
Get the element at the specified index as Double. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getString
Get the element at the specified index as string, with a max length of 32768 bytes It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getShortString
Get the element at the specified index as short string, with a max length of 255 bytes It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getText
Get the element at the specified index as long String, with a max length of 2 GBytes. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getVector2
Get the element at the specified index as SFSVector2.- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getVector3
Get the element at the specified index as SFSVector3.- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getBoolArray
Get the element at the specified index as Collection of Boolean. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getByteArray
byte[] getByteArray(int index) Get the element at the specified index as byte array. It can be null if no element exists for the specified indexNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getUnsignedByteArray
Get the element at the specified index as a Collection of unsigned integers. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getShortArray
Get the element at the specified index as Collection of Short. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getIntArray
Get the element at the specified index as Collection of Int. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getLongArray
Get the element at the specified index as Collection of Long. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getFloatArray
Get the element at the specified index as Collection of Float. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getDoubleArray
Get the element at the specified index as Collection of Double. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getStringArray
Get the element at the specified index as Collection of String. It can be null if no element exists for the specified index Each string is limited to 32768 bytes- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getShortStringArray
Get the element at the specified index as Collection of String. It can be null if no element exists for the specified index Each string is limited to 255 bytes- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getVector2Array
Get the element at the specified index as Collection of SFSVector2. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getVector3Array
Get the element at the specified index as Collection of SFSVector3. It can be null if no element exists for the specified index Each string is limited to 255 bytes- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getSFSArray
Get the element at the specified index as ISFSArray. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).
-
getSFSObject
Get the element at the specified index as ISFSObject. It can be null if no element exists for the specified index- Parameters:
index-- Returns:
- the element, or null
- Throws:
IndexOutOfBoundsException- - if the index is out of range (index < 0 || index >= size()).- See Also:
-