The data is stored in the values buffer. Once this is full the data is sorted in place and written out. The class cannot be used again until beginSlice is called again.
The in place sort is achieved as follows: Each new item is added to the beginning of the buffer, and a pointer is written to the end. Once the buffer is filled the pointers at the end are sorted where the order is determined by comparing the keys they point to. Once they are ordered the data can be read out by reading through the pointers and emitting the value that corresponds to them.
This class is NOT threadSafe.
|
|