System.Runtime.Remoting.Channels.ChunkedMemoryStream.WriteByte C# (CSharp) Method

WriteByte() public method

public WriteByte ( byte value ) : void
value byte
return void
        public override void WriteByte(byte value)
        {
            if (_bClosed)
            {                
                throw new RemotingException(
                    CoreChannel.GetResourceString("Remoting_Stream_StreamIsClosed"));
            }
        
            if (_chunks == null)
            {
                _chunks = AllocateMemoryChunk();
                _writeChunk = _chunks;
                _writeOffset = 0;
            }            

            byte[] chunkBuffer = _writeChunk.Buffer;
            int chunkSize = chunkBuffer.Length;
    
            if (_writeOffset == chunkSize)
            {
                // allocate a new chunk if the current one is full
                _writeChunk.Next = AllocateMemoryChunk();
                _writeChunk = _writeChunk.Next;
                _writeOffset = 0;
                chunkBuffer = _writeChunk.Buffer;
                chunkSize = chunkBuffer.Length;
            }
            
            chunkBuffer[_writeOffset++] = value;
        } // WriteByte