[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadFromStream(byte[] buffer, int count)
{
if (count <= 0) return;
var total = 0;
do
{
var got = m_Stream.Read(buffer, total, count - total);
if (got < 1) //EOF
throw new BixException(StringConsts.BIX_STREAM_CORRUPTED_ERROR + "ReadFromStream(Need: {0}; Got: {1})".Args(count, total));
total += got;
} while (total < count);
}
Test for memoryStream and use blockcopy instead