コード例 #1
0
 public override void Flush()
 {
     try
     {
         if (_data != null)
         {
             Debug.Assert(_pos <= _data.Length);
             _stream.WriteSize(_pos);
             _stream.WriteByteSpan(_data.AsSpan(0, _pos));
         }
         else
         {
             _stream.RewriteSize(_pos, _startPos); // Patch previously-written dummy value.
         }
     }
     catch (Exception ex)
     {
         throw new IOException("could not flush stream", ex);
     }
 }