ByteArray

From Pointui

Allows the manipulation of dynamically allocated byte data.

AVAILABLE SINCE: 2.0.18b

Contents

Methods

void SetSize(int sizeInBytes)

Ensures the array is large enough to contain the requested sizeInBytes number of bytes. If the current allocated size is larger or equal to sizeInBytes then the existing allocated array is reused and updated to be the specified number of bytes in size - this would leave all data it contains intact. However, if sizeInBytes is larger than the current allocation then the current block of data is discarded and a new block of the required size is allocated.

void GetLength()

Returns the size of the array in bytes. If SetSize() has been called multiple times then there may actually be more memory allocated than the current array is reporting with GetLength(). To ensure memory is freed when reusing the same ByteArray object you must call Clear().

void Clear()

Frees the array of bytes.

void Fill(int byteFillValue)

Sets each byte of the array to the value specified in byteFillValue.

void SetByte(int index, int byteValue)

void SetWord(int index, int wordValue)

void SetDWord(int index, int dwordValue)

Sets a byte (8 bit), word (16 bit), or dword (32 bit) within the array of bytes. The index is interpreted differently for each - when setting a byte the index is the number of bytes offset from the beginning of the array, when setting a word the index is the number of words (2 bytes) offset from the beginning of the array, and when setting a dword the index is the number of dwords (4 bytes) offset from the beginning of the array.

int GetByte(int index)

int GetWord(int index)

int GetDWord(int index)

Reads a byte (8 bit), word (16 bit), or dword (32 bit) from within the array of bytes. The index is interpreted differently for each - when setting a byte the index is the number of bytes offset from the beginning of the array, when setting a word the index is the number of words (2 bytes) offset from the beginning of the array, and when setting a dword the index is the number of dwords (4 bytes) offset from the beginning of the array.