Redzen.IO.MemoryBlockStream.ReadByte C# (CSharp) Method

ReadByte() public method

Reads a byte from the stream.
public ReadByte ( ) : int
return int
        public override int ReadByte()
        {
            if(!this._isOpen) throw new ObjectDisposedException("Stream is closed.");

            // Test for end of stream (or beyond end).
            if(_position >= _length) {
                return -1;
            }

            // Read byte.
            int blkIdx = _position / _blockSize;
            int blkOffset = _position++ % _blockSize;
            return _blockList[blkIdx][blkOffset];
        }