FMLiveSwitchDataBufferFramer Class Reference

A utility class that allows a continuous stream of data to be written to it with properly framed messages being read out of it. More...

Instance Methods

(FMLiveSwitchDataBuffer *) - availableDataBuffer
 Gets the available data. More...
 
(int) - availableLength
 Gets the available length. More...
 
(void) - destroy
 Destroys this instance. More...
 
(int) - footprint
 Gets the size of the internal data buffer, in bytes. More...
 
(NSString *) - getHexString
 Gets the hexadecimal string representing the current contents of the data buffer. More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchDataBufferFramer class. More...
 
(FMLiveSwitchDataBuffer *) - readWithGetFrameLength:
 Reads a data buffer from the internal data buffer. More...
 
(FMLiveSwitchDataBuffer *) - readWithGetFrameLengthBlock
 Reads a data buffer from the internal data buffer. More...
 
(FMLiveSwitchDataBuffer *) - readWithGetFrameLengthBlock:
 Reads a data buffer from the internal data buffer. More...
 
(void) - writeWithDataBuffer:
 Writes a data buffer to the internal data buffer. More...
 

Class Methods

(FMLiveSwitchDataBufferFramer *) + dataBufferFramer
 Initializes a new instance of the FMLiveSwitchDataBufferFramer class. More...
 

Detailed Description

A utility class that allows a continuous stream of data to be written to it with properly framed messages being read out of it.

This class is not thread-safe for concurrent reads/writes.

Method Documentation

◆ availableDataBuffer

- (FMLiveSwitchDataBuffer*) availableDataBuffer

Gets the available data.

◆ availableLength

- (int) availableLength

Gets the available length.

◆ dataBufferFramer

+ (FMLiveSwitchDataBufferFramer*) dataBufferFramer

Initializes a new instance of the FMLiveSwitchDataBufferFramer class.

◆ destroy

- (void) destroy

Destroys this instance.

◆ footprint

- (int) footprint

Gets the size of the internal data buffer, in bytes.

◆ getHexString

- (NSString*) getHexString

Gets the hexadecimal string representing the current contents of the data buffer.

◆ init

- (instancetype) init

Initializes a new instance of the FMLiveSwitchDataBufferFramer class.

◆ readWithGetFrameLength:

- (FMLiveSwitchDataBuffer*) readWithGetFrameLength: (FMLiveSwitchFunction1< FMLiveSwitchDataBuffer *, id > *)  getFrameLength

Reads a data buffer from the internal data buffer.

Parameters
getFrameLengthA callback that returns the next frame length.

◆ readWithGetFrameLengthBlock

- (FMLiveSwitchDataBuffer*) readWithGetFrameLengthBlock

Reads a data buffer from the internal data buffer.

@inlineparam getFrameLengthBlock A callback that returns the next frame length.

◆ readWithGetFrameLengthBlock:

- (FMLiveSwitchDataBuffer*) readWithGetFrameLengthBlock: (int(^)(FMLiveSwitchDataBuffer *))  getFrameLengthBlock

Reads a data buffer from the internal data buffer.

Parameters
getFrameLengthBlockA callback that returns the next frame length.

◆ writeWithDataBuffer:

- (void) writeWithDataBuffer: (FMLiveSwitchDataBuffer *)  dataBuffer

Writes a data buffer to the internal data buffer.

Parameters
dataBufferThe data buffer.