SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSArray Class Reference

#import <SFSArray.h>

Inherits NSObject, and <ISFSArray>.

Instance Methods

(BOOL) - contains:
 
(id) - getElementAt:
 
(SFSDataWrapper *) - getWrappedElementAt:
 
(id) - removeElementAt:
 
(NSInteger) - size
 
(NSData *) - toBinary
 
(NSString *) - getDump:
 
(NSString *) - getHexDump
 
(void) - addNull
 
(void) - addBool:
 
(void) - addByte:
 
(void) - addShort:
 
(void) - addInt:
 
(void) - addLong:
 
(void) - addFloat:
 
(void) - addDouble:
 
(void) - addUtfString:
 
(void) - addBoolArray:
 
(void) - addByteArray:
 
(void) - addShortArray:
 
(void) - addIntArray:
 
(void) - addLongArray:
 
(void) - addFloatArray:
 
(void) - addDoubleArray:
 
(void) - addUtfStringArray:
 
(void) - addSFSArray:
 
(void) - addSFSObject:
 
(void) - addClass:
 
(void) - addText:
 
(void) - add:
 
(BOOL) - isNull:
 
(BOOL) - getBool:
 
(NSInteger) - getByte:
 
(NSInteger) - getUnsignedByte:
 
(NSInteger) - getShort:
 
(NSInteger) - getInt:
 
(NSNumber *) - getLong:
 
(NSNumber *) - getFloat:
 
(NSNumber *) - getDouble:
 
(NSString *) - getUtfString:
 
(NSArray *) - getBoolArray:
 
(NSData *) - getByteArray:
 
(NSArray *) - getUnsignedByteArray:
 
(NSArray *) - getShortArray:
 
(NSArray *) - getIntArray:
 
(NSArray *) - getLongArray:
 
(NSArray *) - getFloatArray:
 
(NSArray *) - getDoubleArray:
 
(NSArray *) - getUtfStringArray:
 
(id< ISFSArray >) - getSFSArray:
 
(id< ISFSObject >) - getSFSObject:
 
(id) - getClass:
 
(NSString *) - getText:
 

Class Methods

(SFSArray *) + newFromArray:
 
(SFSArray *) + newFromBinaryData:
 
(SFSArray *) + newInstance
 

Detailed Description

SFSArray is used from both server and client sides to exchange data. It can be thought of a specialized Array/List object that can contain any type of data.

The advantage of using SFSArray is that you can fine tune the way your data will be transmitted over the network. For instance, a number like 100 can be transmitted as a normal integer (which takes 32 bits) but also a short (16 bit) or even a byte (8 bit)

SFSArray supports many primitive data types and related arrays of primitives. It also allows to serialize class instances and rebuild them on the Java side. This is explained in greater detail in a separate document.

More details and examples.

See also
ISFSArray
SFSObject

Method Documentation

◆ addBool:

- (void) addBool: (BOOL)  value

Add a Boolean value

◆ addBoolArray:

- (void) addBoolArray: (NSArray *)  value

Add an array of Booleans

◆ addByte:

- (void) addByte: (NSInteger)  value

Add a byte value (8 bit)

◆ addByteArray:

- (void) addByteArray: (NSData *)  value

Add an array of bytes

◆ addDouble:

- (void) addDouble: (NSNumber *)  value

Add a dobule value (64 bit)

◆ addDoubleArray:

- (void) addDoubleArray: (NSArray *)  value

Add an array of doubles

◆ addFloat:

- (void) addFloat: (NSNumber *)  value

Add a float value (32 bit)

◆ addFloatArray:

- (void) addFloatArray: (NSArray *)  value

Add an array of floats

◆ addInt:

- (void) addInt: (NSInteger)  value

Add an int value (32 bit)

◆ addIntArray:

- (void) addIntArray: (NSArray *)  value

Add an array of ints

◆ addLong:

- (void) addLong: (NSNumber *)  value

Add a long int value (64 bit)

◆ addLongArray:

- (void) addLongArray: (NSArray *)  value

Add an array of long ints

◆ addNull

- (void) addNull

Add a null element

◆ addSFSArray:

- (void) addSFSArray: (id<ISFSArray>)  value

Add an SFSArray

◆ addSFSObject:

- (void) addSFSObject: (id<ISFSObject>)  value

Add an SFSObject

See also
SFSObject

◆ addShort:

- (void) addShort: (NSInteger)  value

Add a short int value (16 bit)

◆ addShortArray:

- (void) addShortArray: (NSArray *)  value

Add an array of short ints

◆ addText:

- (void) addText: (NSString*)  value

Add a UTF-8 string to the end of this array (use with strings > 32KB, up to 2GB) Requires API 1.7.x or higher

◆ addUtfString:

- (void) addUtfString: (NSString *)  value

Add a UTF-8 String (use with strings <= 32KB)

◆ addUtfStringArray:

- (void) addUtfStringArray: (NSArray *)  value

Add an array of UTF-8 String

◆ contains:

- (BOOL) contains: (id)  obj

Returns true if the passed object is contained in the Array

◆ getBool:

- (BOOL) getBool: (NSInteger)  index

Get a Boolean element at the provided index

◆ getBoolArray:

- (NSArray *) getBoolArray: (NSInteger)  index

Get a Boolean Array element at the provided index

◆ getByte:

- (NSInteger) getByte: (NSInteger)  index

Get a byte element at the provided index

◆ getByteArray:

- (NSData *) getByteArray: (NSInteger)  index

Get a byte Array element at the provided index

◆ getDouble:

- (NSNumber *) getDouble: (NSInteger)  index

Get a double element at the provided index

◆ getDoubleArray:

- (NSArray *) getDoubleArray: (NSInteger)  index

Get a double Array element at the provided index

◆ getDump:

- (NSString *) getDump: (BOOL)  format

Return a formatted dump of the object that can logged or traced in the console for debugging purposes.

Parameters
formatturns the "pretty print" on/off

◆ getElementAt:

- (id) getElementAt: (NSInteger)  index

Returns the element at the specified index

◆ getFloat:

- (NSNumber *) getFloat: (NSInteger)  index

Get a float element at the provided index

◆ getFloatArray:

- (NSArray *) getFloatArray: (NSInteger)  index

Get a float Array element at the provided index

◆ getHexDump

- (NSString *) getHexDump

Returns a detailed hex-dump of the object that can logged or traced in the console for debugging purposes.

◆ getInt:

- (NSInteger) getInt: (NSInteger)  index

Get an int element at the provided index

◆ getIntArray:

- (NSArray *) getIntArray: (NSInteger)  index

Get a int Array element at the provided index

◆ getLong:

- (NSNumber *) getLong: (NSInteger)  index

Get a long int element at the provided index

◆ getLongArray:

- (NSArray *) getLongArray: (NSInteger)  index

Get a lomg Array element at the provided index

◆ getSFSArray:

- (id< ISFSArray >) getSFSArray: (NSInteger)  index

Get an SFSArray element at the provided index

◆ getSFSObject:

- (id< ISFSObject >) getSFSObject: (NSInteger)  index

Get an SFSObject element at the provided index

◆ getShort:

- (NSInteger) getShort: (NSInteger)  index

Get a short int element at the provided index

◆ getShortArray:

- (NSArray *) getShortArray: (NSInteger)  index

Get a short Array element at the provided index

◆ getText:

- (NSString *) getText: (NSInteger)  index

Get a String element at the provided index (use with strings > 32KB) Requires API 1.7.x or higher

◆ getUnsignedByte:

- (NSInteger) getUnsignedByte: (NSInteger)  index

Get an unsigned byte element at the provided index

◆ getUnsignedByteArray:

- (NSArray *) getUnsignedByteArray: (NSInteger)  index

Get an Array of unsigned integers at the provided index

◆ getUtfString:

- (NSString *) getUtfString: (NSInteger)  index

Get a String element at the provided index

◆ getUtfStringArray:

- (NSArray *) getUtfStringArray: (NSInteger)  index

Get a String Array element at the provided index

◆ isNull:

- (BOOL) isNull: (NSInteger)  index

Checks if a certain element in the Array is null

◆ newFromArray:

+ (SFSArray *) newFromArray: (NSArray *)  arr

Alternative static constructor that builds an SFSArray populated with the data found in the passed Array

◆ newFromBinaryData:

+ (SFSArray *) newFromBinaryData: (NSData *)  data

Alternative static constructor that builds an SFSArray from a valid SFSArray binary representation

◆ newInstance

+ (SFSArray *) newInstance

Alternative static constructor

◆ removeElementAt:

- (id) removeElementAt: (NSInteger)  index

Remove the element at the specified index

◆ size

- (NSInteger) size

Return the number of elements in the Array

◆ toBinary

- (NSData *) toBinary

Return the binary form of the object