PipeStream.Write Method

Definition

Overloads

Write(ReadOnlySpan<Byte>)

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write(Byte[], Int32, Int32)

Writes a block of bytes to the current stream using data from a buffer.

Write(ReadOnlySpan<Byte>)

Source:
PipeStream.Unix.cs
Source:
PipeStream.Unix.cs
Source:
PipeStream.Unix.cs

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public:
 override void Write(ReadOnlySpan<System::Byte> buffer);
public override void Write (ReadOnlySpan<byte> buffer);
override this.Write : ReadOnlySpan<byte> -> unit
Public Overrides Sub Write (buffer As ReadOnlySpan(Of Byte))

Parameters

buffer
ReadOnlySpan<Byte>

A region of memory. This method copies the contents of this region to the current stream.

Exceptions

The stream does not support writing.

Cannot access a closed pipe.

The pipe is broken.

The pipe hasn't been connected yet.

-or-

The pipe is in a disconnected state.

-or-

The pipe handle has not been set. (Did your PipeStream implementation call InitializeHandle(SafePipeHandle, Boolean, Boolean)?

Remarks

Use the CanWrite property to determine whether the current instance supports writing. Use the WriteAsync method to write asynchronously to the current stream.

If the write operation is successful, the position within the stream advances by the number of bytes written. If an exception occurs, the position within the stream remains unchanged.

Applies to

Write(Byte[], Int32, Int32)

Source:
PipeStream.Unix.cs
Source:
PipeStream.Unix.cs
Source:
PipeStream.Unix.cs

Writes a block of bytes to the current stream using data from a buffer.

public:
 override void Write(cli::array <System::Byte> ^ buffer, int offset, int count);
public override void Write (byte[] buffer, int offset, int count);
[System.Security.SecurityCritical]
public override void Write (byte[] buffer, int offset, int count);
override this.Write : byte[] * int * int -> unit
[<System.Security.SecurityCritical>]
override this.Write : byte[] * int * int -> unit
Public Overrides Sub Write (buffer As Byte(), offset As Integer, count As Integer)

Parameters

buffer
Byte[]

The buffer that contains data to write to the pipe.

offset
Int32

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

count
Int32

The maximum number of bytes to write to the current stream.

Attributes

Exceptions

buffer is null.

offset is less than 0.

-or-

count is less than 0.

count is greater than the number of bytes available in buffer.

The pipe is closed.

The pipe does not support write operations.

The pipe is broken or another I/O error occurred.

Remarks

Use the CanWrite property to determine whether the current PipeStream object supports write operations.

For asynchronous write operations, see BeginWrite and EndWrite.

Applies to