internal BufferOffsetSize[] GetBuffers() {
if (Empty) {
return null;
}
GlobalLog.Print("ScatterGatherBuffers#" + ValidationHelper.HashString(this) + "::ToArray() chunkCount:" + chunkCount.ToString());
BufferOffsetSize[] array = new BufferOffsetSize[chunkCount];
int index = 0;
MemoryChunk thisMemoryChunk = headChunk;
while (thisMemoryChunk!=null) {
GlobalLog.Print("ScatterGatherBuffers#" + ValidationHelper.HashString(this) + "::ToArray() index:" + index.ToString() + " size:" + thisMemoryChunk.FreeOffset);
//
// buffer itself is referenced by the BufferOffsetSize struct, data is not copied
//
array[index] = new BufferOffsetSize(thisMemoryChunk.Buffer, 0, thisMemoryChunk.FreeOffset, false);
index++;
thisMemoryChunk = thisMemoryChunk.Next;
}
return array;
}