FMLiveSwitchCircularDataBuffer Class Reference

A DataBuffer that uses a circular buffer to manage data. More...

Instance Methods

(void) - appendDataBuffer:
 Appends a data buffer to the correct place in this circular data buffer. More...
 
(int) - beginWriteWithMaxWriteSize:
 Tells the CircularDataBuffer to expect more data of up to maxWriteSize. More...
 
(int) - capacity
 Gets the capacity of this CircularDataBuffer. More...
 
(NSMutableData *) - data
 Gets the data. More...
 
(void) - discardWithAmount:
 Advances the Index by amount so the space used by the data can be reused. More...
 
(void) - endWriteWithActuallyWrittenSize:
 Tells the CircularDataBuffer how much data was actually written so that the Length can be set appropriately. More...
 
(FMLiveSwitchDataBuffer *) - free
 Frees the internal pooled DataBuffer. More...
 
- Instance Methods inherited from FMLiveSwitchDataBuffer
(bool) - and:offset:
 Performs a bitwise "and" operation on a value. More...
 
(FMLiveSwitchDataBuffer *) - appendWithBuffer:
 Appends a buffer. More...
 
(FMLiveSwitchDataBuffer *) - appendWithBuffers:
 Appends some buffers. More...
 
(bool) - canResizeWithNewLength:offset:
 Gets whether this buffer can be resized to the new length. More...
 
(FMLiveSwitchDataBuffer *) - clone
 Clones this instance. More...
 
(FMLiveSwitchDataBuffer *) - cloneWithLittleEndian:
 Clones this instance. More...
 
(FMLiveSwitchDataBuffer *) - copy
 Copies this instance into new memory. More...
 
(FMLiveSwitchDataBuffer *) - copyWithUsePool:
 Copies this instance. More...
 
(int) - index
 Gets the index. More...
 
(NSMutableData *) - innerData
 Gets backing data buffer. More...
 
(bool) - isPooled
 Gets whether this DataBuffer is from a pool. More...
 
(bool) - isSubset
 Gets whether this DataBuffer is a subset. More...
 
(FMLiveSwitchDataBuffer *) - keep
 Increment the retain count by one. More...
 
(int) - length
 Gets the length. More...
 
(bool) - littleEndian
 Gets whether data is little-endian. More...
 
(bool) - or:offset:
 Performs a bitwise "or" operation on a value. More...
 
(FMLiveSwitchDataBuffer *) - prependWithBuffer:
 Prepends a buffer. More...
 
(void) - prependWithBuffers:
 Prepends some buffers. More...
 
(int) - read10SignedWithOffset:bitOffset:
 Reads a 10-bit signed value. More...
 
(int) - read10WithOffset:bitOffset:
 Reads a 10-bit value. More...
 
(int) - read11SignedWithOffset:bitOffset:
 Reads a 11-bit signed value. More...
 
(int) - read11WithOffset:bitOffset:
 Reads a 11-bit value. More...
 
(int) - read12SignedWithOffset:bitOffset:
 Reads a 12-bit signed value. More...
 
(int) - read12WithOffset:bitOffset:
 Reads a 12-bit value. More...
 
(int) - read13SignedWithOffset:bitOffset:
 Reads a 13-bit signed value. More...
 
(int) - read13WithOffset:bitOffset:
 Reads a 13-bit value. More...
 
(int) - read14SignedWithOffset:bitOffset:
 Reads a 14-bit signed value. More...
 
(int) - read14WithOffset:bitOffset:
 Reads a 14-bit value. More...
 
(int) - read15SignedWithOffset:bitOffset:
 Reads a 15-bit signed value. More...
 
(int) - read15WithOffset:bitOffset:
 Reads a 15-bit value. More...
 
(int) - read16SignedWithOffset:
 Reads a 16-bit signed value. More...
 
(int) - read16SignedWithOffset:offsetPlus:
 Reads a 16-bit signed value. More...
 
(int) - read16WithOffset:
 Reads a 16-bit value. More...
 
(int) - read16WithOffset:offsetPlus:
 Reads a 16-bit value. More...
 
(int) - read17SignedWithOffset:bitOffset:
 Reads a 17-bit signed value. More...
 
(int) - read17WithOffset:bitOffset:
 Reads a 17-bit value. More...
 
(int) - read18SignedWithOffset:bitOffset:
 Reads an 18-bit signed value. More...
 
(int) - read18WithOffset:bitOffset:
 Reads an 18-bit value. More...
 
(int) - read19SignedWithOffset:bitOffset:
 Reads a 19-bit signed value. More...
 
(int) - read19WithOffset:bitOffset:
 Reads a 19-bit value. More...
 
(bool) - read1WithOffset:bitOffset:
 Reads a 1-bit value. More...
 
(int) - read20SignedWithOffset:bitOffset:
 Reads a 20-bit signed value. More...
 
(int) - read20WithOffset:bitOffset:
 Reads a 20-bit value. More...
 
(int) - read21SignedWithOffset:bitOffset:
 Reads a 21-bit signed value. More...
 
(int) - read21WithOffset:bitOffset:
 Reads a 21-bit value. More...
 
(int) - read22SignedWithOffset:bitOffset:
 Reads a 22-bit signed value. More...
 
(int) - read22WithOffset:bitOffset:
 Reads a 22-bit value. More...
 
(int) - read23SignedWithOffset:bitOffset:
 Reads a 23-bit signed value. More...
 
(int) - read23WithOffset:bitOffset:
 Reads a 23-bit value. More...
 
(int) - read24SignedWithOffset:
 Reads a 24-bit signed value. More...
 
(int) - read24SignedWithOffset:offsetPlus:
 Reads a 24-bit signed value. More...
 
(int) - read24WithOffset:
 Reads a 24-bit value. More...
 
(int) - read24WithOffset:offsetPlus:
 Reads a 24-bit value. More...
 
(int) - read2SignedWithOffset:bitOffset:
 Reads a 2-bit signed value. More...
 
(int) - read2WithOffset:bitOffset:
 Reads a 2-bit value. More...
 
(long long) - read32SignedWithOffset:
 Reads a 32-bit signed value. More...
 
(long long) - read32SignedWithOffset:offsetPlus:
 Reads a 32-bit signed value. More...
 
(long long) - read32WithOffset:
 Reads a 32-bit value. More...
 
(long long) - read32WithOffset:offsetPlus:
 Reads a 32-bit value. More...
 
(int) - read3SignedWithOffset:bitOffset:
 Reads a 3-bit signed value. More...
 
(int) - read3WithOffset:bitOffset:
 Reads a 3-bit value. More...
 
(long long) - read40SignedWithOffset:
 Reads a 40-bit signed value. More...
 
(long long) - read40SignedWithOffset:offsetPlus:
 Reads a 40-bit signed value. More...
 
(long long) - read40WithOffset:
 Reads a 40-bit value. More...
 
(long long) - read40WithOffset:offsetPlus:
 Reads a 40-bit value. More...
 
(long long) - read48SignedWithOffset:
 Reads a 48-bit signed value. More...
 
(long long) - read48SignedWithOffset:offsetPlus:
 Reads a 48-bit signed value. More...
 
(long long) - read48WithOffset:
 Reads a 48-bit value. More...
 
(long long) - read48WithOffset:offsetPlus:
 Reads a 48-bit value. More...
 
(int) - read4SignedWithOffset:bitOffset:
 Reads a 4-bit signed value. More...
 
(int) - read4WithOffset:bitOffset:
 Reads a 4-bit value. More...
 
(long long) - read56SignedWithOffset:
 Reads a 56-bit signed value. More...
 
(long long) - read56SignedWithOffset:offsetPlus:
 Reads a 56-bit signed value. More...
 
(long long) - read56WithOffset:
 Reads a 56-bit value. More...
 
(long long) - read56WithOffset:offsetPlus:
 Reads a 56-bit value. More...
 
(int) - read5SignedWithOffset:bitOffset:
 Reads a 5-bit signed value. More...
 
(int) - read5WithOffset:bitOffset:
 Reads a 5-bit value. More...
 
(long long) - read64SignedWithOffset:
 Reads a 64-bit signed value. More...
 
(long long) - read64SignedWithOffset:offsetPlus:
 Reads a 64-bit signed value. More...
 
(long long) - read64WithOffset:
 Reads a 64-bit value. More...
 
(long long) - read64WithOffset:offsetPlus:
 Reads a 64-bit value. More...
 
(int) - read6SignedWithOffset:bitOffset:
 Reads a 6-bit signed value. More...
 
(int) - read6WithOffset:bitOffset:
 Reads a 6-bit value. More...
 
(int) - read7SignedWithOffset:bitOffset:
 Reads a 7-bit signed value. More...
 
(int) - read7WithOffset:bitOffset:
 Reads a 7-bit value. More...
 
(int) - read8SignedWithOffset:
 Reads an 8-bit signed value. More...
 
(int) - read8SignedWithOffset:offsetPlus:
 Reads an 8-bit signed value. More...
 
(int) - read8WithOffset:
 Reads an 8-bit value. More...
 
(int) - read8WithOffset:offsetPlus:
 Reads an 8-bit value. More...
 
(int) - read9SignedWithOffset:bitOffset:
 Reads a 9-bit signed value. More...
 
(int) - read9WithOffset:bitOffset:
 Reads a 9-bit value. More...
 
(NSString *) - readUtf8StringWithOffset:
 Read a UTF-8 string. More...
 
(NSString *) - readUtf8StringWithOffset:length:
 Reads a UTF-8 string. More...
 
(void) - resizeWithNewLength:
 Resizes this buffer to a new length with new data being inserted at the end. More...
 
(void) - resizeWithNewLength:offset:
 Resizes this buffer to a new length with new data being inserted at a given offset. More...
 
(void) - resizeWithNewLength:offset:setZero:
 Resizes this buffer to a new length with new data being inserted at a given offset. More...
 
(bool) - sequenceEqualsConstantTimeWithBuffer:
 Compares a data buffer for equality in constant time. More...
 
(bool) - sequenceEqualsWithBuffer:
 Compares a data buffer for equality. More...
 
(void) - set:
 Sets the data buffer to the specified value. More...
 
(void) - set:offset:
 Sets a subset of the data buffer to the specified value. More...
 
(void) - set:offset:length:
 Sets a subset of the data buffer to the specified value. More...
 
(void) - setInnerData:
 Sets backing data buffer. More...
 
(void) - setLittleEndian:
 Sets whether data is little-endian. More...
 
(FMLiveSwitchDataBuffer *) - subsetWithOffset:
 Gets a subset of this instance. More...
 
(FMLiveSwitchDataBuffer *) - subsetWithOffset:length:
 Gets a subset of this instance. More...
 
(NSMutableData *) - toArray
 Converts this instance to an array of bytes. More...
 
(NSMutableData *) - toBytes
 Converts this instance to an array of bytes. More...
 
(NSString *) - toHexString
 Converts this instance to a hexadecimal string. More...
 
(NSString *) - toJson
 Serializes this instance to JSON. More...
 
(bool) - tryKeep
 Attempts to increment the retain count by one. More...
 
(bool) - tryRead10WithOffset:bitOffset:value:
 Tries to read a 10-bit value. More...
 
(bool) - tryRead11WithOffset:bitOffset:value:
 Tries to read an 11-bit value. More...
 
(bool) - tryRead12WithOffset:bitOffset:value:
 Tries to read a 12-bit value. More...
 
(bool) - tryRead13WithOffset:bitOffset:value:
 Tries to read a 13-bit value. More...
 
(bool) - tryRead14WithOffset:bitOffset:value:
 Tries to read a 14-bit value. More...
 
(bool) - tryRead15WithOffset:bitOffset:value:
 Tries to read a 15-bit value. More...
 
(bool) - tryRead16WithOffset:value:
 Tries to read a 16-bit value. More...
 
(bool) - tryRead17WithOffset:bitOffset:value:
 Tries to read a 17-bit value. More...
 
(bool) - tryRead18WithOffset:bitOffset:value:
 Tries to read an 18-bit value. More...
 
(bool) - tryRead19WithOffset:bitOffset:value:
 Tries to read a 19-bit value. More...
 
(bool) - tryRead1WithOffset:bitOffset:value:
 Tries to read a 1-bit value. More...
 
(bool) - tryRead20WithOffset:bitOffset:value:
 Tries to read a 20-bit value. More...
 
(bool) - tryRead21WithOffset:bitOffset:value:
 Tries to read a 21-bit value. More...
 
(bool) - tryRead22WithOffset:bitOffset:value:
 Tries to read a 22-bit value. More...
 
(bool) - tryRead23WithOffset:bitOffset:value:
 Tries to read a 23-bit value. More...
 
(bool) - tryRead24WithOffset:value:
 Tries to read a 24-bit value. More...
 
(bool) - tryRead2WithOffset:bitOffset:value:
 Tries to read a 2-bit value. More...
 
(bool) - tryRead32WithOffset:value:
 Tries to read a 32-bit value. More...
 
(bool) - tryRead3WithOffset:bitOffset:value:
 Tries to read a 3-bit value. More...
 
(bool) - tryRead40WithOffset:value:
 Tries to read a 40-bit value. More...
 
(bool) - tryRead48WithOffset:value:
 Tries to read a 48-bit value. More...
 
(bool) - tryRead4WithOffset:bitOffset:value:
 Tries to read a 4-bit value. More...
 
(bool) - tryRead56WithOffset:value:
 Tries to read a 56-bit value. More...
 
(bool) - tryRead5WithOffset:bitOffset:value:
 Tries to read a 5-bit value. More...
 
(bool) - tryRead64WithOffset:value:
 Tries to read a 64-bit value. More...
 
(bool) - tryRead6WithOffset:bitOffset:value:
 Tries to read a 6-bit value. More...
 
(bool) - tryRead7WithOffset:bitOffset:value:
 Tries to read a 7-bit value. More...
 
(bool) - tryRead8WithOffset:value:
 Tries to read an 8-bit value. More...
 
(bool) - tryRead9WithOffset:bitOffset:value:
 Tries to read a 9-bit value. More...
 
(bool) - write1:offset:bitOffset:
 Writes a 1-bit value. More...
 
(bool) - write10:offset:bitOffset:
 Writes a 10-bit value. More...
 
(bool) - write11:offset:bitOffset:
 Writes an 11-bit value. More...
 
(bool) - write12:offset:bitOffset:
 Writes a 12-bit value. More...
 
(bool) - write13:offset:bitOffset:
 Writes a 13-bit value. More...
 
(bool) - write14:offset:bitOffset:
 Writes a 14-bit value. More...
 
(bool) - write15:offset:bitOffset:
 Writes a 15-bit value. More...
 
(bool) - write16:offset:
 Writes a 16-bit value. More...
 
(bool) - write16:offset:offsetPlus:
 Writes a 16-bit value. More...
 
(bool) - write16Signed:offset:
 Writes a signed 16-bit value. More...
 
(bool) - write17:offset:bitOffset:
 Writes a 17-bit value. More...
 
(bool) - write18:offset:bitOffset:
 Writes an 18-bit value. More...
 
(bool) - write19:offset:bitOffset:
 Writes a 19-bit value. More...
 
(bool) - write2:offset:bitOffset:
 Writes a 2-bit value. More...
 
(bool) - write20:offset:bitOffset:
 Writes a 20-bit value. More...
 
(bool) - write21:offset:bitOffset:
 Writes a 21-bit value. More...
 
(bool) - write22:offset:bitOffset:
 Writes a 22-bit value. More...
 
(bool) - write23:offset:bitOffset:
 Writes a 23-bit value. More...
 
(bool) - write24:offset:
 Writes a 24-bit value. More...
 
(bool) - write24:offset:offsetPlus:
 Writes a 24-bit value. More...
 
(bool) - write3:offset:bitOffset:
 Writes a 3-bit value. More...
 
(bool) - write32:offset:
 Writes a 32-bit value. More...
 
(bool) - write32:offset:offsetPlus:
 Writes a 32-bit value. More...
 
(bool) - write4:offset:bitOffset:
 Writes a 4-bit value. More...
 
(bool) - write40:offset:
 Writes a 40-bit value. More...
 
(bool) - write40:offset:offsetPlus:
 Writes a 40-bit value. More...
 
(bool) - write48:offset:
 Writes a 48-bit value. More...
 
(bool) - write48:offset:offsetPlus:
 Writes a 48-bit value. More...
 
(bool) - write5:offset:bitOffset:
 Writes a 5-bit value. More...
 
(bool) - write56:offset:
 Writes a 56-bit value. More...
 
(bool) - write56:offset:offsetPlus:
 Writes a 56-bit value. More...
 
(bool) - write6:offset:bitOffset:
 Writes a 6-bit value. More...
 
(bool) - write64:offset:
 Writes a 64-bit value. More...
 
(bool) - write64:offset:offsetPlus:
 Writes a 64-bit value. More...
 
(bool) - write7:offset:bitOffset:
 Writes a 7-bit value. More...
 
(bool) - write8:offset:
 Writes an 8-bit value. More...
 
(bool) - write8:offset:offsetPlus:
 Writes an 8-bit value. More...
 
(bool) - write9:offset:bitOffset:
 Writes a 9-bit value. More...
 
(void) - writeBytes:
 Writes a byte array to this instance. More...
 
(void) - writeBytes:bytesIndex:bytesLength:offset:
 Writes a byte array to this instance. More...
 
(void) - writeBytes:bytesIndex:bytesLength:offset:offsetPlus:
 Writes a byte array to this instance. More...
 
(void) - writeBytes:bytesIndex:offset:
 Writes a byte array to this instance. More...
 
(void) - writeBytes:offset:
 Writes a byte array to this instance. More...
 
(void) - writeWithBuffer:
 Writes a data buffer to this instance. More...
 
(void) - writeWithBuffer:offset:
 Writes a data buffer to this instance. More...
 
(void) - writeWithBuffer:offset:offsetPlus:
 Writes a data buffer to this instance. More...
 
(bool) - xor:offset:
 Performs a bitwise "xor" operation on a value. More...
 

Class Methods

(FMLiveSwitchCircularDataBuffer *) + createWithInitialSize:
 Creates a new instance of the CircularDataBuffer that can hold a initial amount of data. More...
 
- Class Methods inherited from FMLiveSwitchDataBuffer
(FMLiveSwitchDataBuffer *) + allocateWithCount:
 Allocates a new data buffer with a given size (in bytes) in big-endian format. More...
 
(FMLiveSwitchDataBuffer *) + allocateWithCount:littleEndian:
 Allocates a new data buffer with a given size (in bytes). More...
 
(bool) + areEqualWithBuffer1:buffer2:
 Tests if the two buffers have equal contents. More...
 
(FMLiveSwitchDataBuffer *) + empty
 Gets an empty data buffer. More...
 
(FMLiveSwitchDataBuffer *) + fromBytes:
 Creates an instance from an array of bytes. More...
 
(FMLiveSwitchDataBuffer *) + fromBytes:littleEndian:
 Creates an instance from an array of bytes. More...
 
(FMLiveSwitchDataBuffer *) + fromHexString:
 Creates an instance from a hexadecimal string. More...
 
(FMLiveSwitchDataBuffer *) + fromHexString:littleEndian:
 Creates an instance from a hexadecimal string. More...
 
(NSMutableArray *) + fromJsonArrayWithDataBuffersJson:
 Deserializes an array of instances from JSON. More...
 
(FMLiveSwitchDataBuffer *) + fromJsonWithDataBufferJson:
 Deserializes an instance from JSON. More...
 
(NSString *) + toJsonArrayWithDataBuffers:
 Serializes an array of instances to JSON. More...
 
(NSString *) + toJsonWithDataBuffer:
 Serializes an instance to JSON. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:
 Produces a new data buffer containing supplied data in big-endian format. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:index:
 Produces a new data buffer containing supplied data in big-endian format. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:index:length:
 Produces a new data buffer containing supplied data in big-endian format. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:index:length:littleEndian:
 Produces a new data buffer containing supplied data. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:index:littleEndian:
 Produces a new data buffer containing supplied data. More...
 
(FMLiveSwitchDataBuffer *) + wrapWithData:littleEndian:
 Produces a new data buffer containing supplied data. More...
 

Detailed Description

A DataBuffer that uses a circular buffer to manage data.

Method Documentation

◆ appendDataBuffer:

- (void) appendDataBuffer: (FMLiveSwitchDataBuffer *)  buffer

Appends a data buffer to the correct place in this circular data buffer.

Parameters
bufferThe buffer to write.

◆ beginWriteWithMaxWriteSize:

- (int) beginWriteWithMaxWriteSize: (int)  maxWriteSize

Tells the CircularDataBuffer to expect more data of up to maxWriteSize.

Will reshuffle data around or resize if necessary.

Parameters
maxWriteSizeThe amount of bytes to make available for writing.

◆ capacity

- (int) capacity

Gets the capacity of this CircularDataBuffer.

◆ createWithInitialSize:

+ (FMLiveSwitchCircularDataBuffer*) createWithInitialSize: (int)  initialSize

Creates a new instance of the CircularDataBuffer that can hold a initial amount of data.

Parameters
initialSizeThe initial size of the inner buffer.

◆ data

- (NSMutableData*) data

Gets the data.

Implements FMLiveSwitchDataBuffer.

◆ discardWithAmount:

- (void) discardWithAmount: (int)  amount

Advances the Index by amount so the space used by the data can be reused.

Parameters
amountThe amount to advance the Index by.

◆ endWriteWithActuallyWrittenSize:

- (void) endWriteWithActuallyWrittenSize: (int)  actuallyWrittenSize

Tells the CircularDataBuffer how much data was actually written so that the Length can be set appropriately.

Parameters
actuallyWrittenSizeThe amount of data actually written to the data buffer.

◆ free

Frees the internal pooled DataBuffer.

Implements FMLiveSwitchDataBuffer.