NSData(ConversionExtensions) Category Reference

Declared in NSData+ConversionExtensions.h

Overview

NSData+ConversionExtensions converts NSDate bytes to standard types (float, NSUInteger, NSString, NSDate)

– shortFloatToFloat

Converts an NSData representing a short float to float

- (float)shortFloatToFloat

Return Value

The float representaiton of the short float value

Declared In

NSData+ConversionExtensions.h

– shortFloatAtRange:

Converts the short float represented by the bytes in the given range to a float

- (float)shortFloatAtRange:(NSRange)range

Parameters

range

The range of the bytes to convert

Return Value

The float value of the short float represented by the bytes

Declared In

NSData+ConversionExtensions.h

– unsignedIntegerAtRange:

Converts the bytes in the given range to an unsigned integer value

- (NSUInteger)unsignedIntegerAtRange:(NSRange)range

Parameters

range

The range of the bytes to convert

Return Value

The unsigned integer represented by the bytes

Discussion

If the byte range length is only 3 bytes, a 32-bit unsigned integer will be returned

Declared In

NSData+ConversionExtensions.h

– integerAtRange:

Converts the bytes in the given range to an integer value

- (NSInteger)integerAtRange:(NSRange)range

Parameters

range

The range of the bytes to convert

Return Value

The integer represented by the bytes

Discussion

If the byte range length is only 3 bytes, a 32-bit integer will be returned

Declared In

NSData+ConversionExtensions.h

– stringAtRange:

Converts the bytes in the given range to a string

- (NSString *)stringAtRange:(NSRange)range

Parameters

range

The range of the bytes to convert

Return Value

The string represented by the bytes

Declared In

NSData+ConversionExtensions.h

– parseDateFromStringWithFormat:andRange:

Converts the bytes in the given range to a date using the given string format

- (NSDate *)parseDateFromStringWithFormat:(NSString *)dateFormat andRange:(NSRange)range

Parameters

dateFormat

The format of the date

range

The range of the bytes to convert

Return Value

The date represented by the bytes for the given format

Declared In

NSData+ConversionExtensions.h

– parseDateWithSecondsSinceReferenceDateWithRange:

Converts the bytes in the given range to a date

- (NSDate *)parseDateWithSecondsSinceReferenceDateWithRange:(NSRange)range

Parameters

range

The range of the bytes to convert

Return Value

The date since the reference data represented by the bytes

Discussion

This method assume the bytes in the given range represent an integer with second resolution

Declared In

NSData+ConversionExtensions.h