You are here: Start » Function Reference » All Functions » Binary Data » ReadBufferArrayFromBuffer
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Splits chunk of data from byte buffer into array of buffers of equal sizes.
Syntax
void fil::ReadBufferArrayFromBuffer ( const fil::ByteBuffer& inBuffer, int inOffset, int inElementSize, int inElementsCount, ftl::Array<fil::ByteBuffer>& outArray, int& outOffset )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inBuffer | const ByteBuffer& | Source data | ||
![]() |
inOffset | int | 0 - ![]() |
0 | Read start position |
![]() |
inElementSize | int | 0 - ![]() |
4 | Length in bytes of single array element |
![]() |
inElementsCount | int | 0 - 33554432 | 0 | Amount of array elements to read |
![]() |
outArray | Array<ByteBuffer>& | Buffers array with copied data | ||
![]() |
outOffset | int& | Resulting position behind read data |
Description
This filter can be helpful when reading an array from byte buffer. It can split a portion of data from the source buffer on the inBuffer input and split it into specified number of buffers returned on the outArray outputs. All buffers in the items of the output array must have the same size. Size of resulting buffers is specified by the inElementSize input. Number of buffers in the resulting array is specified by the inElementsCount input. Total number of bytes read by this filter can be calculated by multiplying the values from the inElementSize and inElementsCount inputs.
Data is read starting at the position provided by the inOffset input (in bytes). This position is than advanced by the size of read data and returned on the outOffset output. This output can be connected to the inOffset input of other byte buffer reading filter when reading consecutive fields of data structures. When data read spans beyond the end of the input buffer an IOError is raised.
This filter is usually a beginning of an array execution of other buffer reading filters.
Errors
List of possible exceptions:
Error type | Description |
---|---|
IoError | Empty byte buffer at input of ReadBufferArrayFromBuffer. |
IoError | Reading beyond the end of the byte buffer. Source data range specified by the inOffset, inElementSize and inElementsCount inputs spans beyond the end of the byte buffer. |
See Also
- WriteBufferArrayToBuffer – Writes connected content of all source buffer array items into other byte buffer.