SFByteReader
Objective-C
@interface SFByteReader : NSObject
Swift
class SFByteReader : NSObject
Read through byte data
-
Next byte index to read
Declaration
Objective-C
@property int nextByte;
Swift
var nextByte: Int32 { get set }
-
Bytes to read
Declaration
Objective-C
@property (nonatomic, strong) NSData *bytes;
Swift
var bytes: Data! { get set }
-
Byte order used to read, little or big endian
Declaration
Objective-C
@property (nonatomic) CFByteOrder byteOrder;
Swift
var byteOrder: CFByteOrder { get set }
-
Initialize
Declaration
Objective-C
- (instancetype)initWithData:(NSData *)bytes;
Swift
init!(data bytes: Data!)
Parameters
bytes
byte data
Return Value
new byte reader
-
Initialize
Declaration
Objective-C
- (instancetype)initWithData:(NSData *)bytes andByteOrder:(CFByteOrder)byteOrder;
Swift
init!(data bytes: Data!, andByteOrder byteOrder: CFByteOrder)
Parameters
bytes
byte data
byteOrder
byte order
Return Value
new byte reader
-
Read a String from the provided number of bytes
Declaration
Objective-C
- (NSString *)readString:(int)num;
Swift
func readString(_ num: Int32) -> String!
Parameters
num
number of bytes to read
Return Value
string value
-
Read a single byte
Declaration
Objective-C
- (NSNumber *)readByte;
Swift
func readByte() -> NSNumber!
Return Value
byte
-
Read Data with the provided number of bytes
Declaration
Objective-C
- (NSData *)readData:(int)num;
Swift
func readData(_ num: Int32) -> Data!
Parameters
num
number of bytes to read
Return Value
data value
-
Read an integer (4 bytes)
Declaration
Objective-C
- (NSNumber *)readInt;
Swift
func readInt() -> NSNumber!
Return Value
integer
-
Read a double (8 bytes)
Declaration
Objective-C
- (NSDecimalNumber *)readDouble;
Swift
func readDouble() -> NSDecimalNumber!
Return Value
double