Exemple #1
0
        public override MemoryStream NioBuffer(int index, int length)
        {
            if (_components.Count == 1)
            {
                var buf = _components[0].Buf;
                if (buf.NioBufferCount() == 1)
                {
                    return(_components[0].Buf.NioBuffer(index, length));
                }
            }
            var merged  = Convenient.Allocate(length); // little-endian
            var buffers = NioBuffers(index, length);

            for (int i = 0; i < buffers.Length; i++)
            {
                merged.Put(buffers[i]);
            }

            merged.Flip();
            return(merged);
        }