public int GetData(GATData target, int targetLength, int offsetInTarget, bool reverse = false)
{
int nextIndex = ( int )_nextIndex;
int sign = reverse ? -1 : 1;
int lastIndex = nextIndex + targetLength * sign;
if (lastIndex >= _data.Count)
{
targetLength = _data.Count - nextIndex;
}
else if (lastIndex < 0)
{
targetLength = nextIndex + 1;
lastIndex = 0;
}
if (reverse == false)
{
target.CopyFrom(_data.ParentArray, offsetInTarget, nextIndex + _data.MemOffset, targetLength);
}
else
{
target.CopyFrom(_data.ParentArray, offsetInTarget, lastIndex + _data.MemOffset, targetLength);
target.Reverse(offsetInTarget, targetLength);
}
_nextIndex = ( int )lastIndex;
return(targetLength);
}