Class SFSObject

  • All Implemented Interfaces:
    ISFSObject, java.io.Serializable
    Direct Known Subclasses:
    SFSObjectLite

    public class SFSObject
    extends java.lang.Object
    implements ISFSObject, java.io.Serializable
    SFSObject and SFSArray represent a platform-neutral, high level objects that abstract the data transport between client and server. They are used to respectively represent data in form of a Map/Dictionary or List/Array and they can be nested and transport many different data types (from bytes to integers, doubles, strings and a lot more)

    These two classes provide a fine-grained control over each data item sent over the network and provide high speed serialization using the default SFS2X binary protocol.

    Let's consider this simple example: we need to send the data relative to a combat vehicle in a multiplayer game.

     ISFSObject sfso = new SFSObject();
     sfso.putByte("id", 10);
     sfso.putShort("health", 5000);
     sfso.putIntArray("pos", Arrays.asList(120,150));
     sfso.putUtfString("name", "Hurricane"); 
     
    In the above code we can use a single Byte (signed 8-bit) to send any small integer value, a Short (signed 16-bit) for larger values and integers for any number that should be represented as regular 32-bit value.

    The following is a list of type supported by the SFSObject class:

    • null
    • boolean
    • byte
    • short
    • int
    • long
    • float
    • double
    • utf-string
    • boolean array
    • byte array
    • short array
    • int array
    • long array
    • float array
    • double array
    • utf-string array
    • SFSObject
    • SFSArray

    NOTE: UTF-8/multi-byte strings are not supported in key names. In other words you should restrict key names to standard ASCII characters.

    It is also recommended to keep key names very short to save bandwidth. Strings values, instead, are handled via UTF-8 encoding, to support all languages and character sets. SFSObjects and SFSArrays can be nested to create complex data structures.

    Limitations: UTF Strings length is expressed using a signed short integer which means that a string can be up to 32768 characters. (Sending a larger text can be done via set/getText methods) The same applies to all the array types whose length is encoded in the same way, thus limiting the max length of an array to 32768 elements.

    NOTE: SFSObject is not thread safe.

    See Also:
    SFSArray, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SFSObject()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Looks for a specific key in the object
      SFSDataWrapper get​(java.lang.String key)  
      java.lang.Boolean getBool​(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.Byte getByte​(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.Object getClass​(java.lang.String key)
      Get the element for the specified key as a Class instance.
      java.lang.Double getDouble​(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.String getDump()
      Get a detailed dump of the SFSObject structure
      java.lang.String getDump​(boolean noFormat)
      Get a detailed dump of the SFSObject structure
      java.lang.Float getFloat​(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.String getHexDump()
      Get a pretty-printed hex-dump of the object
      java.lang.Integer getInt​(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 keys
      java.lang.Long getLong​(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.
      ISFSArray getSFSArray​(java.lang.String key)
      Get the element for the specified key as ISFSArray.
      ISFSObject getSFSObject​(java.lang.String key)
      Get the element for the specified key as ISFSObject.
      java.lang.Short getShort​(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.String getText​(java.lang.String key)
      Get the element for the specified key as String using UTF-8 encoding.
      java.lang.Integer getUnsignedByte​(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.String getUtfString​(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.
      boolean isNull​(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()  
      static SFSObject newFromBinaryData​(byte[] bytes)
      Rebuild an SFSObject form its binary form
      static ISFSObject newFromJsonData​(java.lang.String jsonStr)
      Creates an SFSObject from a JSON literal.
      static SFSObject newFromObject​(java.lang.Object o)
      Converts any POJO (Plain Old Java Object) into an SFSObject providing a number of conventions and supported data types.
      static SFSObject newFromResultSet​(java.sql.ResultSet rset)  
      static SFSObject newInstance()
      Static constructor, similar to new SFSObject();
      void put​(java.lang.String key, SFSDataWrapper wrappedObject)  
      void putBool​(java.lang.String key, boolean value)
      Add a boolean
      void putBoolArray​(java.lang.String key, java.util.Collection<java.lang.Boolean> value)
      Add a Collection of boolean
      void putByte​(java.lang.String key, byte value)
      Add a byte (signed 8-bit)
      void putByteArray​(java.lang.String key, byte[] value)
      Add an array of bytes
      void putClass​(java.lang.String key, java.lang.Object o)
      Add a Class instance.
      void putDouble​(java.lang.String key, double value)
      Add a double value (signed 32-bit)
      void putDoubleArray​(java.lang.String key, java.util.Collection<java.lang.Double> value)
      Add a Collection of double
      void putFloat​(java.lang.String key, float value)
      Add a float value (signed 32-bit)
      void putFloatArray​(java.lang.String key, java.util.Collection<java.lang.Float> value)
      Add a Collection of float
      void putInt​(java.lang.String key, int value)
      Add a short value (signed 32-bit)
      void putIntArray​(java.lang.String key, java.util.Collection<java.lang.Integer> value)
      Add a Collection of int
      void putLong​(java.lang.String key, long value)
      Add a long value (signed 32-bit)
      void putLongArray​(java.lang.String key, java.util.Collection<java.lang.Long> value)
      Add a Collection of long
      void putNull​(java.lang.String key)
      Add a null field to the Object.
      void putSFSArray​(java.lang.String key, ISFSArray value)
      Add a nested ISFSArray
      void putSFSObject​(java.lang.String key, ISFSObject value)
      Add a nested SFSObject
      void putShort​(java.lang.String key, short value)
      Add a short value (signed 16-bit)
      void putShortArray​(java.lang.String key, java.util.Collection<java.lang.Short> value)
      Add a Collection of short
      void putText​(java.lang.String key, java.lang.String value)
      Add a string value (encoded in UTF-8), with a limit of 2 GBytes.
      void putUtfString​(java.lang.String key, java.lang.String value)
      Add a string value (encoded in UTF-8), with a limit of 32 KBytes.
      void putUtfStringArray​(java.lang.String key, java.util.Collection<java.lang.String> value)
      Add a Collection of string
      boolean removeElement​(java.lang.String key)
      Remove an element in the object
      int size()
      Get the size of the SFSObject
      byte[] toBinary()
      Return a binary representation of the object
      java.lang.String toJson()
      Return a JSON representation of the object
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SFSObject

        public SFSObject()
    • Method Detail

      • newFromObject

        public static SFSObject newFromObject​(java.lang.Object o)
        Converts any POJO (Plain Old Java Object) into an SFSObject providing a number of conventions and supported data types.

        Supported types:

        • null
        • boolean, Boolean
        • byte, Byte
        • short, Short
        • int, Integer
        • long, Long
        • float, Float
        • double, Double
        • String
        • Collection
        • Map
        • Array types
        • Nested POJOs

        Other rules:

        • Private fields are accessed from regular Java getters/setters, if they don't exist fields are ignored
        • Public fields are accessed directly
        • Static fields are ignored
        • Transient fields are ignored

        Conventions: When de-serialized on the other end the system will look for a Class with the same fully qualified name and will attempt to instantiate it and populate with the received data via reflection.

        NOTE: complex objects might take up a significantly large amount of bytes compared to regular SFSObjects. If message size is a critical element and Class serialization seem to create too large packets we recommend to add a toSFSObject() and fromSFSObject() methods on your classes to generate smaller representations of the data you need to transfer.
        Also, if possible, try to export only the fields that are strictly necessary and using the most suitable data type (e.g a byte or short for small numbers, etc...)

      • newFromBinaryData

        public static SFSObject newFromBinaryData​(byte[] bytes)
        Rebuild an SFSObject form its binary form
        Parameters:
        bytes - the binary data
        Returns:
        the original SFSObject
        Throws:
        java.lang.IllegalStateException - if there's any problem with decoding the binary data
      • newFromJsonData

        public static ISFSObject newFromJsonData​(java.lang.String jsonStr)
        Creates an SFSObject from a JSON literal. Type conversion is done as follows:

        JSON SFSObject
        Bool Bool
        Number Integer, Long, Double (autodetect)
        String UTF String
        Array SFSArray
        Object SFSObject
        Parameters:
        jsonStr - the JSON literal
        Returns:
        the SFSObject
      • newFromResultSet

        public static SFSObject newFromResultSet​(java.sql.ResultSet rset)
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • newInstance

        public static SFSObject newInstance()
        Static constructor, similar to new SFSObject();
        Returns:
        a new SFSObject
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Description copied from interface: ISFSObject
        Looks for a specific key in the object
        Specified by:
        containsKey in interface ISFSObject
        Returns:
        true if the element exists
      • removeElement

        public boolean removeElement​(java.lang.String key)
        Description copied from interface: ISFSObject
        Remove an element in the object
        Specified by:
        removeElement in interface ISFSObject
        Parameters:
        key - the element name
        Returns:
        true if the element was really present in the object
      • size

        public int size()
        Description copied from interface: ISFSObject
        Get the size of the SFSObject
        Specified by:
        size in interface ISFSObject
        Returns:
        the number of elements contained in the SFSObject
      • toBinary

        public byte[] toBinary()
        Description copied from interface: ISFSObject
        Return a binary representation of the object
        Specified by:
        toBinary in interface ISFSObject
        Returns:
        a binary representation of the object
      • toJson

        public java.lang.String toJson()
        Description copied from interface: ISFSObject
        Return a JSON representation of the object
        Specified by:
        toJson in interface ISFSObject
        Returns:
        a JSON representation of the object
      • getDump

        public java.lang.String getDump()
        Description copied from interface: ISFSObject
        Get a detailed dump of the SFSObject structure
        Specified by:
        getDump in interface ISFSObject
        Returns:
        a detailed dump of the SFSObject structure
      • getDump

        public java.lang.String getDump​(boolean noFormat)
        Description copied from interface: ISFSObject
        Get a detailed dump of the SFSObject structure
        Specified by:
        getDump in interface ISFSObject
        Parameters:
        noFormat - if true the dump will not be pretty-printed
        Returns:
        a detailed dump of the SFSObject structure
      • getHexDump

        public java.lang.String getHexDump()
        Description copied from interface: ISFSObject
        Get a pretty-printed hex-dump of the object
        Specified by:
        getHexDump in interface ISFSObject
        Returns:
        a pretty-printed hex-dump of the object
      • isNull

        public boolean isNull​(java.lang.String key)
        Description copied from interface: ISFSObject
        Checks if a specific element is of SFSDataType.NULL.
        Specified by:
        isNull in interface ISFSObject
        Parameters:
        key - the property name
        Returns:
        true if the item is null
      • getBool

        public java.lang.Boolean getBool​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as Boolean. It can be null if no element exists for the specified key
        Specified by:
        getBool in interface ISFSObject
        Returns:
        the element, or null
      • getBoolArray

        public java.util.Collection<java.lang.Boolean> getBoolArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Booleans. It can be null if no element exists for the specified key
        Specified by:
        getBoolArray in interface ISFSObject
        Returns:
        the element, or null
      • getByte

        public java.lang.Byte getByte​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as Byte (signed 8 bit). It can be null if no element exists for the specified key
        Specified by:
        getByte in interface ISFSObject
        Returns:
        the element, or null
      • getByteArray

        public byte[] getByteArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Byte. It can be null if no element exists for the specified key

        NOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.

        Specified by:
        getByteArray in interface ISFSObject
        Returns:
        the element, or null
      • getDouble

        public java.lang.Double getDouble​(java.lang.String key)
        Description copied from interface: ISFSObject
        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
        Specified by:
        getDouble in interface ISFSObject
        Returns:
        the element, or null
      • getDoubleArray

        public java.util.Collection<java.lang.Double> getDoubleArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Double. It can be null if no element exists for the specified key
        Specified by:
        getDoubleArray in interface ISFSObject
        Returns:
        the element, or null
      • getFloat

        public java.lang.Float getFloat​(java.lang.String key)
        Description copied from interface: ISFSObject
        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
        Specified by:
        getFloat in interface ISFSObject
        Returns:
        the element, or null
      • getFloatArray

        public java.util.Collection<java.lang.Float> getFloatArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Float. It can be null if no element exists for the specified key
        Specified by:
        getFloatArray in interface ISFSObject
        Returns:
        the element, or null
      • getInt

        public java.lang.Integer getInt​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as Integer (signed 32 bit). It can be null if no element exists for the specified key
        Specified by:
        getInt in interface ISFSObject
        Returns:
        the element, or null
      • getIntArray

        public java.util.Collection<java.lang.Integer> getIntArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Integer. It can be null if no element exists for the specified key
        Specified by:
        getIntArray in interface ISFSObject
        Returns:
        the element, or null
      • getKeys

        public java.util.Set<java.lang.String> getKeys()
        Description copied from interface: ISFSObject
        Get a Set of all keys
        Specified by:
        getKeys in interface ISFSObject
        Returns:
        all the keys
      • getLong

        public java.lang.Long getLong​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as Long (signed 64 bit). It can be null if no element exists for the specified key
        Specified by:
        getLong in interface ISFSObject
        Returns:
        the element, or null
      • getLongArray

        public java.util.Collection<java.lang.Long> getLongArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Long. It can be null if no element exists for the specified key
        Specified by:
        getLongArray in interface ISFSObject
        Returns:
        the element, or null
      • getSFSArray

        public ISFSArray getSFSArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as ISFSArray. It can be null if no element exists for the specified key
        Specified by:
        getSFSArray in interface ISFSObject
        Returns:
        the element, or null
        See Also:
        ISFSArray
      • getSFSObject

        public ISFSObject getSFSObject​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as ISFSObject. It can be null if no element exists for the specified key
        Specified by:
        getSFSObject in interface ISFSObject
        Returns:
        the element, or null
      • getShort

        public java.lang.Short getShort​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as Short (signed 16 bit). It can be null if no element exists for the specified key
        Specified by:
        getShort in interface ISFSObject
        Returns:
        the element, or null
      • getShortArray

        public java.util.Collection<java.lang.Short> getShortArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of Short. It can be null if no element exists for the specified key
        Specified by:
        getShortArray in interface ISFSObject
        Returns:
        the element, or null
      • getUnsignedByte

        public java.lang.Integer getUnsignedByte​(java.lang.String key)
        Description copied from interface: ISFSObject
        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
        Specified by:
        getUnsignedByte in interface ISFSObject
        Returns:
        the element, or null
      • getUnsignedByteArray

        public java.util.Collection<java.lang.Integer> getUnsignedByteArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        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
        Specified by:
        getUnsignedByteArray in interface ISFSObject
        Returns:
        the element, or null
      • getUtfString

        public java.lang.String getUtfString​(java.lang.String key)
        Description copied from interface: ISFSObject
        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

        Specified by:
        getUtfString in interface ISFSObject
        Returns:
        the element, or null
      • getText

        public java.lang.String getText​(java.lang.String key)
        Description copied from interface: ISFSObject
        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

        Specified by:
        getText in interface ISFSObject
        Returns:
        the element, or null
      • getUtfStringArray

        public java.util.Collection<java.lang.String> getUtfStringArray​(java.lang.String key)
        Description copied from interface: ISFSObject
        Get the element for the specified key as a Collection of String. It can be null if no element exists for the specified key
        Specified by:
        getUtfStringArray in interface ISFSObject
        Returns:
        the element, or null
      • getClass

        public java.lang.Object getClass​(java.lang.String key)
        Description copied from interface: ISFSObject
        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 key

        NOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.

        Specified by:
        getClass in interface ISFSObject
        Returns:
        the element, or null
        See Also:
        newFromObject(Object)
      • putBool

        public void putBool​(java.lang.String key,
                            boolean value)
        Description copied from interface: ISFSObject
        Add a boolean
        Specified by:
        putBool in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putBoolArray

        public void putBoolArray​(java.lang.String key,
                                 java.util.Collection<java.lang.Boolean> value)
        Description copied from interface: ISFSObject
        Add a Collection of boolean
        Specified by:
        putBoolArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putByteArray

        public void putByteArray​(java.lang.String key,
                                 byte[] value)
        Description copied from interface: ISFSObject
        Add an array of bytes

        NOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.

        Specified by:
        putByteArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putDouble

        public void putDouble​(java.lang.String key,
                              double value)
        Description copied from interface: ISFSObject
        Add a double value (signed 32-bit)
        Specified by:
        putDouble in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putDoubleArray

        public void putDoubleArray​(java.lang.String key,
                                   java.util.Collection<java.lang.Double> value)
        Description copied from interface: ISFSObject
        Add a Collection of double
        Specified by:
        putDoubleArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putFloat

        public void putFloat​(java.lang.String key,
                             float value)
        Description copied from interface: ISFSObject
        Add a float value (signed 32-bit)
        Specified by:
        putFloat in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putFloatArray

        public void putFloatArray​(java.lang.String key,
                                  java.util.Collection<java.lang.Float> value)
        Description copied from interface: ISFSObject
        Add a Collection of float
        Specified by:
        putFloatArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putInt

        public void putInt​(java.lang.String key,
                           int value)
        Description copied from interface: ISFSObject
        Add a short value (signed 32-bit)
        Specified by:
        putInt in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putIntArray

        public void putIntArray​(java.lang.String key,
                                java.util.Collection<java.lang.Integer> value)
        Description copied from interface: ISFSObject
        Add a Collection of int
        Specified by:
        putIntArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putLong

        public void putLong​(java.lang.String key,
                            long value)
        Description copied from interface: ISFSObject
        Add a long value (signed 32-bit)
        Specified by:
        putLong in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putLongArray

        public void putLongArray​(java.lang.String key,
                                 java.util.Collection<java.lang.Long> value)
        Description copied from interface: ISFSObject
        Add a Collection of long
        Specified by:
        putLongArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putNull

        public void putNull​(java.lang.String key)
        Description copied from interface: ISFSObject
        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

        Specified by:
        putNull in interface ISFSObject
        Parameters:
        key - the property name
      • putSFSArray

        public void putSFSArray​(java.lang.String key,
                                ISFSArray value)
        Description copied from interface: ISFSObject
        Add a nested ISFSArray
        Specified by:
        putSFSArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
        See Also:
        ISFSArray
      • putSFSObject

        public void putSFSObject​(java.lang.String key,
                                 ISFSObject value)
        Description copied from interface: ISFSObject
        Add a nested SFSObject
        Specified by:
        putSFSObject in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putShort

        public void putShort​(java.lang.String key,
                             short value)
        Description copied from interface: ISFSObject
        Add a short value (signed 16-bit)
        Specified by:
        putShort in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putShortArray

        public void putShortArray​(java.lang.String key,
                                  java.util.Collection<java.lang.Short> value)
        Description copied from interface: ISFSObject
        Add a Collection of short
        Specified by:
        putShortArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putUtfString

        public void putUtfString​(java.lang.String key,
                                 java.lang.String value)
        Description copied from interface: ISFSObject
        Add a string value (encoded in UTF-8), with a limit of 32 KBytes.
        Specified by:
        putUtfString in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putText

        public void putText​(java.lang.String key,
                            java.lang.String value)
        Description copied from interface: ISFSObject
        Add a string value (encoded in UTF-8), with a limit of 2 GBytes.

        Specified by:
        putText in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putUtfStringArray

        public void putUtfStringArray​(java.lang.String key,
                                      java.util.Collection<java.lang.String> value)
        Description copied from interface: ISFSObject
        Add a Collection of string
        Specified by:
        putUtfStringArray in interface ISFSObject
        Parameters:
        key - the property name
        value - the value
      • putClass

        public void putClass​(java.lang.String key,
                             java.lang.Object o)
        Description copied from interface: ISFSObject
        Add a Class instance. The instance must implement the SerializableSFSType interface.
        Specified by:
        putClass in interface ISFSObject
        Parameters:
        key - the property name
        o - the instance

        NOTE: This is not supported for HTML5 / Websocket clients, which includes Unity WebGL exports.

        See Also:
        newFromObject(Object)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object