If your data is usually the same size and always under a certain size, use an array of bytes.
Create byte [] and int, which allows you to find out where the end of the "full" part of this buffer ends, and the "free" part begins. You never need to clean it; just rewrite what was there. The only problem is that sometimes your data is 100 kb, sometimes 10 MB, and sometimes a little more than previously planned.
The list will be slower to use and more in memory, although they process different sizes of data out of the box.
source share