Interface ISFSObject
-
- All Known Implementing Classes:
SFSObject,SFSObjectLite
public interface ISFSObject
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsKey(java.lang.String key)Looks for a specific key in the objectSFSDataWrapperget(java.lang.String key)java.lang.BooleangetBool(java.lang.String key)Get the element for the specified key as Boolean.java.util.Collection<java.lang.Boolean>getBoolArray(java.lang.String key)Get the element for the specified key as a Collection of Booleans.java.lang.BytegetByte(java.lang.String key)Get the element for the specified key as Byte (signed 8 bit).byte[]getByteArray(java.lang.String key)Get the element for the specified key as a Collection of Byte.java.lang.ObjectgetClass(java.lang.String key)Get the element for the specified key as a Class instance.java.lang.DoublegetDouble(java.lang.String key)Get the element for the specified key as Double (signed decimal 64 bit).java.util.Collection<java.lang.Double>getDoubleArray(java.lang.String key)Get the element for the specified key as a Collection of Double.java.lang.StringgetDump()Get a detailed dump of the SFSObject structurejava.lang.StringgetDump(boolean noFormat)Get a detailed dump of the SFSObject structurejava.lang.FloatgetFloat(java.lang.String key)Get the element for the specified key as Float (signed decimal 32 bit).java.util.Collection<java.lang.Float>getFloatArray(java.lang.String key)Get the element for the specified key as a Collection of Float.java.lang.StringgetHexDump()Get a pretty-printed hex-dump of the objectjava.lang.IntegergetInt(java.lang.String key)Get the element for the specified key as Integer (signed 32 bit).java.util.Collection<java.lang.Integer>getIntArray(java.lang.String key)Get the element for the specified key as a Collection of Integer.java.util.Set<java.lang.String>getKeys()Get a Set of all keysjava.lang.LonggetLong(java.lang.String key)Get the element for the specified key as Long (signed 64 bit).java.util.Collection<java.lang.Long>getLongArray(java.lang.String key)Get the element for the specified key as a Collection of Long.ISFSArraygetSFSArray(java.lang.String key)Get the element for the specified key as ISFSArray.ISFSObjectgetSFSObject(java.lang.String key)Get the element for the specified key as ISFSObject.java.lang.ShortgetShort(java.lang.String key)Get the element for the specified key as Short (signed 16 bit).java.util.Collection<java.lang.Short>getShortArray(java.lang.String key)Get the element for the specified key as a Collection of Short.java.lang.StringgetText(java.lang.String key)Get the element for the specified key as String using UTF-8 encoding.java.lang.IntegergetUnsignedByte(java.lang.String key)Get the element for the specified key as unsigned byte.java.util.Collection<java.lang.Integer>getUnsignedByteArray(java.lang.String key)Get the element for the specified key as a Collection of unsigned Byte.java.lang.StringgetUtfString(java.lang.String key)Get the element for the specified key as String using UTF-8 encoding.java.util.Collection<java.lang.String>getUtfStringArray(java.lang.String key)Get the element for the specified key as a Collection of String.booleanisNull(java.lang.String key)Checks if a specific element is of SFSDataType.NULL.java.util.Iterator<java.util.Map.Entry<java.lang.String,SFSDataWrapper>>iterator()voidput(java.lang.String key, SFSDataWrapper wrappedObject)voidputBool(java.lang.String key, boolean value)Add a booleanvoidputBoolArray(java.lang.String key, java.util.Collection<java.lang.Boolean> value)Add a Collection of booleanvoidputByte(java.lang.String key, byte value)Add a byte (signed 8-bit)voidputByteArray(java.lang.String key, byte[] value)Add an array of bytesvoidputClass(java.lang.String key, java.lang.Object o)Add a Class instance.voidputDouble(java.lang.String key, double value)Add a double value (signed 32-bit)voidputDoubleArray(java.lang.String key, java.util.Collection<java.lang.Double> value)Add a Collection of doublevoidputFloat(java.lang.String key, float value)Add a float value (signed 32-bit)voidputFloatArray(java.lang.String key, java.util.Collection<java.lang.Float> value)Add a Collection of floatvoidputInt(java.lang.String key, int value)Add a short value (signed 32-bit)voidputIntArray(java.lang.String key, java.util.Collection<java.lang.Integer> value)Add a Collection of intvoidputLong(java.lang.String key, long value)Add a long value (signed 32-bit)voidputLongArray(java.lang.String key, java.util.Collection<java.lang.Long> value)Add a Collection of longvoidputNull(java.lang.String key)Add a null field to the Object.voidputSFSArray(java.lang.String key, ISFSArray value)Add a nested ISFSArrayvoidputSFSObject(java.lang.String key, ISFSObject value)Add a nested SFSObjectvoidputShort(java.lang.String key, short value)Add a short value (signed 16-bit)voidputShortArray(java.lang.String key, java.util.Collection<java.lang.Short> value)Add a Collection of shortvoidputText(java.lang.String key, java.lang.String value)Add a string value (encoded in UTF-8), with a limit of 2 GBytes.voidputUtfString(java.lang.String key, java.lang.String value)Add a string value (encoded in UTF-8), with a limit of 32 KBytes.voidputUtfStringArray(java.lang.String key, java.util.Collection<java.lang.String> value)Add a Collection of stringbooleanremoveElement(java.lang.String key)Remove an element in the objectintsize()Get the size of the SFSObjectbyte[]toBinary()Return a binary representation of the objectjava.lang.StringtoJson()Return a JSON representation of the object
-
-
-
Method Detail
-
isNull
boolean isNull(java.lang.String key)
Checks if a specific element is of SFSDataType.NULL.- Parameters:
key- the property name- Returns:
- true if the item is null
-
containsKey
boolean containsKey(java.lang.String key)
Looks for a specific key in the object- Returns:
- true if the element exists
-
removeElement
boolean removeElement(java.lang.String key)
Remove an element in the object- Parameters:
key- the element name- Returns:
- true if the element was really present in the object
-
getKeys
java.util.Set<java.lang.String> getKeys()
Get a Set of all keys- Returns:
- all the keys
-
size
int size()
Get the size of the SFSObject- Returns:
- the number of elements contained in the SFSObject
-
iterator
java.util.Iterator<java.util.Map.Entry<java.lang.String,SFSDataWrapper>> iterator()
-
toBinary
byte[] toBinary()
Return a binary representation of the object- Returns:
- a binary representation of the object
-
toJson
java.lang.String toJson()
Return a JSON representation of the object- Returns:
- a JSON representation of the object
-
getDump
java.lang.String getDump()
Get a detailed dump of the SFSObject structure- Returns:
- a detailed dump of the SFSObject structure
-
getDump
java.lang.String getDump(boolean noFormat)
Get a detailed dump of the SFSObject structure- Parameters:
noFormat- if true the dump will not be pretty-printed- Returns:
- a detailed dump of the SFSObject structure
-
getHexDump
java.lang.String getHexDump()
Get a pretty-printed hex-dump of the object- Returns:
- a pretty-printed hex-dump of the object
-
get
SFSDataWrapper get(java.lang.String key)
-
getBool
java.lang.Boolean getBool(java.lang.String key)
Get the element for the specified key as Boolean. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getByte
java.lang.Byte getByte(java.lang.String key)
Get the element for the specified key as Byte (signed 8 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getUnsignedByte
java.lang.Integer getUnsignedByte(java.lang.String key)
Get the element for the specified key as unsigned byte. It can be null if no element exists for the specified key. This method is useful when you need to represent an int value betwee 0-255. In Java bytes are represented as signed bytes. This will convert the byte to an unsigned int- Parameters:
key-- Returns:
- the element, or null
-
getShort
java.lang.Short getShort(java.lang.String key)
Get the element for the specified key as Short (signed 16 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getInt
java.lang.Integer getInt(java.lang.String key)
Get the element for the specified key as Integer (signed 32 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getLong
java.lang.Long getLong(java.lang.String key)
Get the element for the specified key as Long (signed 64 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getFloat
java.lang.Float getFloat(java.lang.String key)
Get the element for the specified key as Float (signed decimal 32 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getDouble
java.lang.Double getDouble(java.lang.String key)
Get the element for the specified key as Double (signed decimal 64 bit). It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getUtfString
java.lang.String getUtfString(java.lang.String key)
Get the element for the specified key as String using UTF-8 encoding. It can be null if no element exists for the specified key.The string is limited to 32 KBytes
- Parameters:
key-- Returns:
- the element, or null
-
getText
java.lang.String getText(java.lang.String key)
Get the element for the specified key as String using UTF-8 encoding. It can be null if no element exists for the specified key.The string is limited to 2 GBytes
- Parameters:
key-- Returns:
- the element, or null
-
getBoolArray
java.util.Collection<java.lang.Boolean> getBoolArray(java.lang.String key)
Get the element for the specified key as a Collection of Booleans. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getByteArray
byte[] getByteArray(java.lang.String key)
Get the element for the specified key as a Collection of Byte. It can be null if no element exists for the specified keyNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- Parameters:
key-- Returns:
- the element, or null
-
getUnsignedByteArray
java.util.Collection<java.lang.Integer> getUnsignedByteArray(java.lang.String key)
Get the element for the specified key as a Collection of unsigned Byte. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getShortArray
java.util.Collection<java.lang.Short> getShortArray(java.lang.String key)
Get the element for the specified key as a Collection of Short. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getIntArray
java.util.Collection<java.lang.Integer> getIntArray(java.lang.String key)
Get the element for the specified key as a Collection of Integer. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getLongArray
java.util.Collection<java.lang.Long> getLongArray(java.lang.String key)
Get the element for the specified key as a Collection of Long. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getFloatArray
java.util.Collection<java.lang.Float> getFloatArray(java.lang.String key)
Get the element for the specified key as a Collection of Float. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getDoubleArray
java.util.Collection<java.lang.Double> getDoubleArray(java.lang.String key)
Get the element for the specified key as a Collection of Double. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getUtfStringArray
java.util.Collection<java.lang.String> getUtfStringArray(java.lang.String key)
Get the element for the specified key as a Collection of String. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getSFSArray
ISFSArray getSFSArray(java.lang.String key)
Get the element for the specified key as ISFSArray. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
- See Also:
ISFSArray
-
getSFSObject
ISFSObject getSFSObject(java.lang.String key)
Get the element for the specified key as ISFSObject. It can be null if no element exists for the specified key- Parameters:
key-- Returns:
- the element, or null
-
getClass
java.lang.Object getClass(java.lang.String key)
Get the element for the specified key as a Class instance. The class definition is contained in the instance itself and it will be rebuilt using reflection. It can be null if no element exists for the specified keyNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- Parameters:
key-- Returns:
- the element, or null
- See Also:
SFSObject.newFromObject(Object)
-
putNull
void putNull(java.lang.String key)
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
- Parameters:
key- the property name
-
putBool
void putBool(java.lang.String key, boolean value)Add a boolean- Parameters:
key- the property namevalue- the value
-
putByte
void putByte(java.lang.String key, byte value)Add a byte (signed 8-bit)- Parameters:
key- the property namevalue- the value- See Also:
getUnsignedByte(String)
-
putShort
void putShort(java.lang.String key, short value)Add a short value (signed 16-bit)- Parameters:
key- the property namevalue- the value
-
putInt
void putInt(java.lang.String key, int value)Add a short value (signed 32-bit)- Parameters:
key- the property namevalue- the value
-
putLong
void putLong(java.lang.String key, long value)Add a long value (signed 32-bit)- Parameters:
key- the property namevalue- the value
-
putFloat
void putFloat(java.lang.String key, float value)Add a float value (signed 32-bit)- Parameters:
key- the property namevalue- the value
-
putDouble
void putDouble(java.lang.String key, double value)Add a double value (signed 32-bit)- Parameters:
key- the property namevalue- the value
-
putUtfString
void putUtfString(java.lang.String key, java.lang.String value)Add a string value (encoded in UTF-8), with a limit of 32 KBytes.- Parameters:
key- the property namevalue- the value
-
putText
void putText(java.lang.String key, java.lang.String value)Add a string value (encoded in UTF-8), with a limit of 2 GBytes.- Parameters:
key- the property namevalue- the value
-
putBoolArray
void putBoolArray(java.lang.String key, java.util.Collection<java.lang.Boolean> value)Add a Collection of boolean- Parameters:
key- the property namevalue- the value
-
putByteArray
void putByteArray(java.lang.String key, byte[] value)Add an array of bytesNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- Parameters:
key- the property namevalue- the value
-
putShortArray
void putShortArray(java.lang.String key, java.util.Collection<java.lang.Short> value)Add a Collection of short- Parameters:
key- the property namevalue- the value
-
putIntArray
void putIntArray(java.lang.String key, java.util.Collection<java.lang.Integer> value)Add a Collection of int- Parameters:
key- the property namevalue- the value
-
putLongArray
void putLongArray(java.lang.String key, java.util.Collection<java.lang.Long> value)Add a Collection of long- Parameters:
key- the property namevalue- the value
-
putFloatArray
void putFloatArray(java.lang.String key, java.util.Collection<java.lang.Float> value)Add a Collection of float- Parameters:
key- the property namevalue- the value
-
putDoubleArray
void putDoubleArray(java.lang.String key, java.util.Collection<java.lang.Double> value)Add a Collection of double- Parameters:
key- the property namevalue- the value
-
putUtfStringArray
void putUtfStringArray(java.lang.String key, java.util.Collection<java.lang.String> value)Add a Collection of string- Parameters:
key- the property namevalue- the value
-
putSFSArray
void putSFSArray(java.lang.String key, ISFSArray value)Add a nested ISFSArray- Parameters:
key- the property namevalue- the value- See Also:
ISFSArray
-
putSFSObject
void putSFSObject(java.lang.String key, ISFSObject value)Add a nested SFSObject- Parameters:
key- the property namevalue- the value
-
putClass
void putClass(java.lang.String key, java.lang.Object o)Add a Class instance. The instance must implement theSerializableSFSTypeinterface.- Parameters:
key- the property nameo- the instanceNOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.
- See Also:
SFSObject.newFromObject(Object)
-
put
void put(java.lang.String key, SFSDataWrapper wrappedObject)
-
-