fm.liveswitch.DataBufferFramer 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...

Public Member Functions

 DataBufferFramer ()
 Initializes a new instance of the fm.liveswitch.DataBufferFramer class. More...
 
void destroy ()
 Destroys this instance. More...
 
fm.liveswitch.DataBuffer getAvailableDataBuffer ()
 Gets the available data. More...
 
int getAvailableLength ()
 Gets the available length. More...
 
int getFootprint ()
 Gets the size of the internal data buffer, in bytes. More...
 
String getHexString ()
 Gets the hexadecimal string representing the current contents of the data buffer. More...
 
fm.liveswitch.DataBuffer read (fm.liveswitch.IFunction1< fm.liveswitch.DataBuffer, Integer > getFrameLength)
 Reads a data buffer from the internal data buffer. More...
 
void write (fm.liveswitch.DataBuffer dataBuffer)
 Writes a data buffer to the internal data buffer. 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.

Constructor & Destructor Documentation

◆ DataBufferFramer()

fm.liveswitch.DataBufferFramer.DataBufferFramer ( )

Initializes a new instance of the fm.liveswitch.DataBufferFramer class.

Member Function Documentation

◆ destroy()

void fm.liveswitch.DataBufferFramer.destroy ( )

Destroys this instance.

◆ getAvailableDataBuffer()

fm.liveswitch.DataBuffer fm.liveswitch.DataBufferFramer.getAvailableDataBuffer ( )

Gets the available data.

◆ getAvailableLength()

int fm.liveswitch.DataBufferFramer.getAvailableLength ( )

Gets the available length.

◆ getFootprint()

int fm.liveswitch.DataBufferFramer.getFootprint ( )

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

◆ getHexString()

String fm.liveswitch.DataBufferFramer.getHexString ( )

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

◆ read()

fm.liveswitch.DataBuffer fm.liveswitch.DataBufferFramer.read ( fm.liveswitch.IFunction1< fm.liveswitch.DataBuffer, Integer >  getFrameLength)

Reads a data buffer from the internal data buffer.

Parameters
getFrameLengthA callback that returns the next frame length.

◆ write()

void fm.liveswitch.DataBufferFramer.write ( fm.liveswitch.DataBuffer  dataBuffer)

Writes a data buffer to the internal data buffer.

Parameters
dataBufferThe data buffer.