BACnet.Core.MultiBufferStream.Read C# (CSharp) Метод

Read() публичный Метод

Reads from the stream
public Read ( byte buffer, int offset, int count ) : int
buffer byte The buffer to read into
offset int The offset to read into
count int The number of bytes to read
Результат int
        public override int Read(byte[] buffer, int offset, int count)
        {
            int read = 0;

            while(count > 0 && _bufferIndex < _buffers.Count)
            {
                int toRead = Math.Min(count, _buffer.End - _offset);
                Array.Copy(_buffer.Buffer, _offset, buffer, offset, toRead);
                count -= toRead;
                read += toRead;
                offset += toRead;
                _offset += toRead;

                if (count > 0 && !_nextBuffer())
                    break;
            }

            return read;
        }