public override void SetLength(long value) { if (SizeableStream != null) { TResult.ThrowIfFailed(SizeableStream.SetStreamSize(value)); return; } throw new NotSupportedException(); }
public override void Write(byte[] buffer, int offset, int count) { IntPtr unmanaged = GetUnmanagedBuffer(ref count); try { for (int i = 0; i < count; i++) { Marshal.WriteByte(unmanaged, i, buffer[offset + i]); } int writtenBytes = 0; int result = BaseStream.Write(unmanaged, count, ref writtenBytes); TResult.ThrowIfFailed(result); } finally { ReleaseUnmanagedBuffer(unmanaged); } }