TIFFByteReader

Objective-C

@interface TIFFByteReader : NSObject

Swift

class TIFFByteReader : 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

  • Check if there is at least one more byte left to read

    Declaration

    Objective-C

    - (BOOL)hasByte;

    Swift

    func hasByte() -> Bool

    Return Value

    true more bytes left to read

  • Check if there is at least one more byte left to read

    Declaration

    Objective-C

    - (BOOL)hasByteWithOffset:(int)offset;

    Swift

    func hasByte(withOffset offset: Int32) -> Bool

    Parameters

    offset

    byte offset

    Return Value

    true more bytes left to read

  • Check if there are the provided number of bytes left to read

    Declaration

    Objective-C

    - (BOOL)hasBytesWithCount:(int)num;

    Swift

    func hasBytes(withCount num: Int32) -> Bool

    Parameters

    num

    number of bytes

    Return Value

    true if has at least the number of bytes left

  • Check if there are the provided number of bytes left to read

    Declaration

    Objective-C

    - (BOOL)hasBytesWithCount:(int)num andOffset:(int)offset;

    Swift

    func hasBytes(withCount num: Int32, andOffset offset: Int32) -> Bool

    Parameters

    num

    number of bytes

    offset

    byte offset

    Return Value

    true if has at least the number of bytes left

  • Read a String from the provided number of bytes

    Declaration

    Objective-C

    - (NSString *)readStringWithCount:(int)num;

    Swift

    func readString(withCount num: Int32) -> String!

    Parameters

    num

    number of bytes

    Return Value

    String @throws UnsupportedEncodingException

  • Read a String from the provided number of bytes

    Declaration

    Objective-C

    - (NSString *)readStringWithCount:(int)num andOffset:(int)offset;

    Swift

    func readString(withCount num: Int32, andOffset offset: Int32) -> String!

    Parameters

    offset

    byte offset

    num

    number of bytes

    Return Value

    String @throws UnsupportedEncodingException

  • Read a single byte

    Declaration

    Objective-C

    - (NSNumber *)readByte;

    Swift

    func readByte() -> NSNumber!

    Return Value

    byte

  • Read a byte

    Declaration

    Objective-C

    - (NSNumber *)readByteWithOffset:(int)offset;

    Swift

    func readByte(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    byte

  • Read an unsigned byte

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedByte;

    Swift

    func readUnsignedByte() -> NSNumber!

    Return Value

    unsigned byte as short

  • Read an unsigned byte

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedByteWithOffset:(int)offset;

    Swift

    func readUnsignedByte(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    unsigned byte as short

  • Read a number of bytes

    Declaration

    Objective-C

    - (NSData *)readBytesWithCount:(int)num;

    Swift

    func readBytes(withCount num: Int32) -> Data!

    Parameters

    num

    number of bytes

    Return Value

    bytes

  • Read a number of bytes

    Declaration

    Objective-C

    - (NSData *)readBytesWithCount:(int)num andOffset:(int)offset;

    Swift

    func readBytes(withCount num: Int32, andOffset offset: Int32) -> Data!

    Parameters

    num

    number of bytes

    offset

    byte offset

    Return Value

    bytes

  • Read a short

    Declaration

    Objective-C

    - (NSNumber *)readShort;

    Swift

    func readShort() -> NSNumber!

    Return Value

    short

  • Read a short

    Declaration

    Objective-C

    - (NSNumber *)readShortWithOffset:(int)offset;

    Swift

    func readShort(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    short

  • Read an unsigned short

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedShort;

    Swift

    func readUnsignedShort() -> NSNumber!

    Return Value

    unsigned short as int

  • Read an unsigned short

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedShortWithOffset:(int)offset;

    Swift

    func readUnsignedShort(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    unsigned short as int

  • Read an integer (4 bytes)

    Declaration

    Objective-C

    - (NSNumber *)readInt;

    Swift

    func readInt() -> NSNumber!

    Return Value

    integer

  • Read an integer

    Declaration

    Objective-C

    - (NSNumber *)readIntWithOffset:(int)offset;

    Swift

    func readInt(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    integer

  • Read an unsigned int

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedInt;

    Swift

    func readUnsignedInt() -> NSNumber!

    Return Value

    unsigned int as long

  • Read an unsigned int

    Declaration

    Objective-C

    - (NSNumber *)readUnsignedIntWithOffset:(int)offset;

    Swift

    func readUnsignedInt(withOffset offset: Int32) -> NSNumber!

    Parameters

    offset

    byte offset

    Return Value

    unsigned int as long

  • Read a float

    Declaration

    Objective-C

    - (NSDecimalNumber *)readFloat;

    Swift

    func readFloat() -> NSDecimalNumber!

    Return Value

    float

  • Read a float

    Declaration

    Objective-C

    - (NSDecimalNumber *)readFloatWithOffset:(int)offset;

    Swift

    func readFloat(withOffset offset: Int32) -> NSDecimalNumber!

    Parameters

    offset

    byte offset

    Return Value

    float

  • Read a double (8 bytes)

    Declaration

    Objective-C

    - (NSDecimalNumber *)readDouble;

    Swift

    func readDouble() -> NSDecimalNumber!

    Return Value

    double

  • Read a double

    Declaration

    Objective-C

    - (NSDecimalNumber *)readDoubleWithOffset:(int)offset;

    Swift

    func readDouble(withOffset offset: Int32) -> NSDecimalNumber!

    Parameters

    offset

    byte offset

    Return Value

    double

  • Get the byte length

    Declaration

    Objective-C

    - (int)byteLength;

    Swift

    func byteLength() -> Int32

    Return Value

    byte length