Interface ISFSObject

    • Method Summary

      All Methods Instance Methods Abstract 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()  
      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
    • 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
      • 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 key

        NOTE: 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 key

        NOTE: 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 name
        value - the value
      • putByte

        void putByte​(java.lang.String key,
                     byte value)
        Add a byte (signed 8-bit)
        Parameters:
        key - the property name
        value - 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 name
        value - the value
      • putInt

        void putInt​(java.lang.String key,
                    int value)
        Add a short value (signed 32-bit)
        Parameters:
        key - the property name
        value - the value
      • putLong

        void putLong​(java.lang.String key,
                     long value)
        Add a long value (signed 32-bit)
        Parameters:
        key - the property name
        value - the value
      • putFloat

        void putFloat​(java.lang.String key,
                      float value)
        Add a float value (signed 32-bit)
        Parameters:
        key - the property name
        value - the value
      • putDouble

        void putDouble​(java.lang.String key,
                       double value)
        Add a double value (signed 32-bit)
        Parameters:
        key - the property name
        value - 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 name
        value - 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 name
        value - 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 name
        value - the value
      • putByteArray

        void putByteArray​(java.lang.String key,
                          byte[] value)
        Add an array of bytes

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

        Parameters:
        key - the property name
        value - 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 name
        value - 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 name
        value - 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 name
        value - 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 name
        value - 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 name
        value - 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 name
        value - the value
      • putSFSArray

        void putSFSArray​(java.lang.String key,
                         ISFSArray value)
        Add a nested ISFSArray
        Parameters:
        key - the property name
        value - the value
        See Also:
        ISFSArray
      • putSFSObject

        void putSFSObject​(java.lang.String key,
                          ISFSObject value)
        Add a nested SFSObject
        Parameters:
        key - the property name
        value - the value
      • putClass

        void putClass​(java.lang.String key,
                      java.lang.Object o)
        Add a Class instance. The instance must implement the SerializableSFSType interface.
        Parameters:
        key - the property name
        o - the instance

        NOTE: 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)