NVorbis.StreamReadBuffer.Read C# (CSharp) Method

Read() public method

Reads the number of bytes specified into the buffer given, starting with the offset indicated.
public Read ( long offset, byte buffer, int index, int count ) : int
offset long The offset into the stream to start reading.
buffer byte The buffer to read to.
index int The index into the buffer to start writing to.
count int The number of bytes to read.
return int
        public int Read(long offset, byte[] buffer, int index, int count)
        {
            if (offset < 0L) throw new ArgumentOutOfRangeException("offset");
            if (buffer == null) throw new ArgumentNullException("buffer");
            if (index < 0 || index + count > buffer.Length) throw new ArgumentOutOfRangeException("index");
            if (count < 0) throw new ArgumentOutOfRangeException("count");
            if (offset >= _wrapper.EofOffset) return 0;

            var startIdx = EnsureAvailable(offset, ref count, false);

            Buffer.BlockCopy(_data, startIdx, buffer, index, count);

            return count;
        }

Usage Example

示例#1
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            CheckLock();
            int num = _buffer.Read(Position, buffer, offset, count);

            Seek(num, SeekOrigin.Current);
            return(num);
        }
All Usage Examples Of NVorbis.StreamReadBuffer::Read