Ejemplo n.º 1
0
 /// <summary>
 ///   Writes a single value to the stream, and advances the current position
 ///   within this stream by the number of bytes written.
 /// </summary>
 /// <remarks>
 /// In order to provide faster read/write, this operation doesn't check stream bound.
 /// A client must carefully not read/write above the size of this datastream.
 /// </remarks>
 /// <typeparam name = "T">The type of the value to be written to the stream.</typeparam>
 /// <param name = "value">The value to write to the stream.</param>
 /// <exception cref = "T:System.NotSupportedException">The stream does not support writing.</exception>
 public void Write <T>(T value) where T : struct
 {
     if (!_canWrite)
     {
         throw new NotSupportedException();
     }
     unsafe
     {
         _position = (byte *)SdxUtilities.WriteAndPosition((IntPtr)(_buffer + _position), ref value) - _buffer;
     }
 }