Mono Class Library: System.IO.Stream Overview | Members

System.IO.Stream.Write Method

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

public abstract void Write (byte[] buffer, int offset, int count)

Parameters

buffer
A byte array containing the data to write. [Edit]
offset
A int that specifies the zero based byte offset in buffer at which to begin copying bytes to the current stream. [Edit]
count
A int that specifies the number of bytes to be written to the current stream. [Edit]

Exceptions

TypeReason
ArgumentException(offset + count ) is greater than the length of buffer. [Edit]
ArgumentNullExceptionbuffer is null. [Edit]
ArgumentOutOfRangeExceptionoffset or count is negative. [Edit]
System.IO.IOExceptionAn I/O error occurred. [Edit]
NotSupportedExceptionThe stream does not support writing. [Edit]
ObjectDisposedExceptionThe stream is closed. [Edit]

Remarks

Note: Use the Stream.CanWrite property to determine whether the current instance supports writing.

Operation
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.

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0