FMLiveSwitchDataBufferStream Class Reference

A data buffer stream. More...

Instance Methods

(int) - available
 Gets the available bytes to be read from the DataBuffer. More...
 
(uint8_t) - bitPosition
 Gets the bit position within a byte. More...
 
(FMLiveSwitchDataBuffer *) - buffer
 Gets the buffer. More...
 
(instancetype) - initWithBuffer:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 
(instancetype) - initWithDataBufferSize:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 
(instancetype) - initWithDataBufferSize:littleEndian:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 
(int) - length
 Gets the buffer length. More...
 
(void) - nextByte
 Resets the bit count to 0 and advances to the next byte. More...
 
(int) - peek
 Reads an 8-bit value from the DataBuffer without advancing the Position. More...
 
(int) - position
 Gets the position within the stream. More...
 
(bool) - read1
 Read a single bit and advance the bit position by 1. More...
 
(int) - read15
 Reads an 15-bit value from the DataBuffer and advances the Position by 1 and the BitPosition by 7. More...
 
(int) - read16
 Reads an 16-bit value from the DataBuffer and advances the Position by 2. More...
 
(int) - read2
 Read a 2-bit value and advance the BitPosition by 2. More...
 
(int) - read24
 Reads an 24-bit value from the DataBuffer and advances the Position by 3. More...
 
(int) - read3
 Read a 3-bit value and advance the BitPosition by 3. More...
 
(long long) - read32
 Reads an 32-bit value from the DataBuffer and advances the Position by 4. More...
 
(int) - read4
 Read a 4-bit value and advance the BitPosition by 4. More...
 
(long long) - read40
 Reads an 40-bit value from the DataBuffer and advances the Position by 5. More...
 
(long long) - read48
 Reads an 48-bit value from the DataBuffer and advances the Position by 6. More...
 
(long long) - read56
 Reads an 56-bit value from the DataBuffer and advances the Position by 7. More...
 
(long long) - read64
 Reads an 64-bit value from the DataBuffer and advances the Position by 8. More...
 
(int) - read7
 Reads an 7-bit value from the DataBuffer and advances the BitPosition by 7. More...
 
(int) - read8
 Reads an 8-bit value from the DataBuffer and advances the Position by 1. More...
 
(int) - readByte
 Reads a single byte from the stream and advances the Position by 1. More...
 
(NSMutableData *) - readBytesWithLength:
 Read a specified number of bytes from the DataBuffer and advance the Position by that number. More...
 
(FMLiveSwitchDataBuffer *) - readWithLength:
 Reads the specified length from the DataBuffer and advances the position by the length. More...
 
(void) - setBitPosition:
 Sets the bit position within a byte. More...
 
(void) - setPosition:
 Sets the position within the stream. More...
 
(FMLiveSwitchDataBufferStream *) - write16:
 Writes an 16-bit value to the DataBuffer and advances the Position by 2. More...
 
(FMLiveSwitchDataBufferStream *) - write32:
 Writes an 32-bit value to the DataBuffer and advances the Position by 4. More...
 
(FMLiveSwitchDataBufferStream *) - write64:
 Writes an 64-bit value to the DataBuffer and advances the Position by 8. More...
 
(FMLiveSwitchDataBufferStream *) - write8:
 Writes an 8-bit value to the DataBuffer and advances the Position by 1. More...
 
(FMLiveSwitchDataBufferStream *) - writeBytesWithData:
 Writes the specified data to the DataBuffer and advances the Position by the length of the data. More...
 
(FMLiveSwitchDataBufferStream *) - writeBytesWithData:index:length:
 Writes the specified data to the DataBuffer and advances the Position by the length. More...
 
(FMLiveSwitchDataBufferStream *) - writeWithBuffer:
 Writes the specified buffer to the DataBuffer and advances the Position by the length of the buffer. More...
 

Class Methods

(FMLiveSwitchDataBufferStream *) + dataBufferStreamWithBuffer:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 
(FMLiveSwitchDataBufferStream *) + dataBufferStreamWithDataBufferSize:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 
(FMLiveSwitchDataBufferStream *) + dataBufferStreamWithDataBufferSize:littleEndian:
 Initializes a new instance of the FMLiveSwitchDataBufferStream class. More...
 

Detailed Description

A data buffer stream.

Method Documentation

◆ available

- (int) available

Gets the available bytes to be read from the DataBuffer.

◆ bitPosition

- (uint8_t) bitPosition

Gets the bit position within a byte.

◆ buffer

Gets the buffer.

◆ dataBufferStreamWithBuffer:

+ (FMLiveSwitchDataBufferStream*) dataBufferStreamWithBuffer: (FMLiveSwitchDataBuffer *)  buffer

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
bufferThe buffer.

◆ dataBufferStreamWithDataBufferSize:

+ (FMLiveSwitchDataBufferStream*) dataBufferStreamWithDataBufferSize: (int)  dataBufferSize

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
dataBufferSizeSize of the data buffer.

◆ dataBufferStreamWithDataBufferSize:littleEndian:

+ (FMLiveSwitchDataBufferStream*) dataBufferStreamWithDataBufferSize: (int)  dataBufferSize
littleEndian: (bool)  littleEndian 

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
dataBufferSizeSize of the data buffer.
littleEndianWhether the data is little-endian.

◆ initWithBuffer:

- (instancetype) initWithBuffer: (FMLiveSwitchDataBuffer *)  buffer

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
bufferThe buffer.

◆ initWithDataBufferSize:

- (instancetype) initWithDataBufferSize: (int)  dataBufferSize

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
dataBufferSizeSize of the data buffer.

◆ initWithDataBufferSize:littleEndian:

- (instancetype) initWithDataBufferSize: (int)  dataBufferSize
littleEndian: (bool)  littleEndian 

Initializes a new instance of the FMLiveSwitchDataBufferStream class.

Parameters
dataBufferSizeSize of the data buffer.
littleEndianWhether the data is little-endian.

◆ length

- (int) length

Gets the buffer length.

◆ nextByte

- (void) nextByte

Resets the bit count to 0 and advances to the next byte.

◆ peek

- (int) peek

Reads an 8-bit value from the DataBuffer without advancing the Position.

◆ position

- (int) position

Gets the position within the stream.

◆ read1

- (bool) read1

Read a single bit and advance the bit position by 1.

◆ read15

- (int) read15

Reads an 15-bit value from the DataBuffer and advances the Position by 1 and the BitPosition by 7.

◆ read16

- (int) read16

Reads an 16-bit value from the DataBuffer and advances the Position by 2.

◆ read2

- (int) read2

Read a 2-bit value and advance the BitPosition by 2.

◆ read24

- (int) read24

Reads an 24-bit value from the DataBuffer and advances the Position by 3.

◆ read3

- (int) read3

Read a 3-bit value and advance the BitPosition by 3.

◆ read32

- (long long) read32

Reads an 32-bit value from the DataBuffer and advances the Position by 4.

◆ read4

- (int) read4

Read a 4-bit value and advance the BitPosition by 4.

◆ read40

- (long long) read40

Reads an 40-bit value from the DataBuffer and advances the Position by 5.

◆ read48

- (long long) read48

Reads an 48-bit value from the DataBuffer and advances the Position by 6.

◆ read56

- (long long) read56

Reads an 56-bit value from the DataBuffer and advances the Position by 7.

◆ read64

- (long long) read64

Reads an 64-bit value from the DataBuffer and advances the Position by 8.

◆ read7

- (int) read7

Reads an 7-bit value from the DataBuffer and advances the BitPosition by 7.

◆ read8

- (int) read8

Reads an 8-bit value from the DataBuffer and advances the Position by 1.

◆ readByte

- (int) readByte

Reads a single byte from the stream and advances the Position by 1.

◆ readBytesWithLength:

- (NSMutableData*) readBytesWithLength: (int)  length

Read a specified number of bytes from the DataBuffer and advance the Position by that number.

Parameters
lengthThe number of bytes to read.

◆ readWithLength:

- (FMLiveSwitchDataBuffer*) readWithLength: (int)  length

Reads the specified length from the DataBuffer and advances the position by the length.

Parameters
lengthThe length.

◆ setBitPosition:

- (void) setBitPosition: (uint8_t)  value

Sets the bit position within a byte.

◆ setPosition:

- (void) setPosition: (int)  value

Sets the position within the stream.

◆ write16:

- (FMLiveSwitchDataBufferStream*) write16: (int)  value

Writes an 16-bit value to the DataBuffer and advances the Position by 2.

Parameters
valueThe value.

◆ write32:

- (FMLiveSwitchDataBufferStream*) write32: (long long)  value

Writes an 32-bit value to the DataBuffer and advances the Position by 4.

Parameters
valueThe value.

◆ write64:

- (FMLiveSwitchDataBufferStream*) write64: (long long)  value

Writes an 64-bit value to the DataBuffer and advances the Position by 8.

Parameters
valueThe value.

◆ write8:

- (FMLiveSwitchDataBufferStream*) write8: (int)  value

Writes an 8-bit value to the DataBuffer and advances the Position by 1.

Parameters
valueThe value.

◆ writeBytesWithData:

- (FMLiveSwitchDataBufferStream*) writeBytesWithData: (NSMutableData *)  data

Writes the specified data to the DataBuffer and advances the Position by the length of the data.

Parameters
dataThe data.

◆ writeBytesWithData:index:length:

- (FMLiveSwitchDataBufferStream*) writeBytesWithData: (NSMutableData *)  data
index: (int)  index
length: (int)  length 

Writes the specified data to the DataBuffer and advances the Position by the length.

Parameters
dataThe data.
indexThe index.
lengthThe length.

◆ writeWithBuffer:

- (FMLiveSwitchDataBufferStream*) writeWithBuffer: (FMLiveSwitchDataBuffer *)  buffer

Writes the specified buffer to the DataBuffer and advances the Position by the length of the buffer.

Parameters
bufferThe buffer.