Revenj.Utility.ChunkedMemoryStream.WriteByte C# (CSharp) Method

WriteByte() public method

Write byte to stream. Advances current position by one. Adds a new block if necessary.
public WriteByte ( byte value ) : void
value byte byte to write
return void
        public override void WriteByte(byte value)
        {
            var off = CurrentPosition & BlockAnd;
            var pos = CurrentPosition >> BlockShift;
            Blocks[pos][off] = value;
            CurrentPosition += 1;
            if (BlockSize == off + 1 && Blocks.Count == pos + 1)
                Blocks.Add(new byte[BlockSize]);
            if (CurrentPosition > TotalSize)
                TotalSize = CurrentPosition;
        }