Mono Class Library: Mono.Unix.UnixStream Overview | Members

Mono.Unix.UnixStream.WriteAtOffset Method

Writes a sequence of bytes to the current stream without advancing the position within the stream.

public void WriteAtOffset (byte[] buffer, int offset, int count, long fileOffset)

See Also

Mono.Unix.Native.Syscall.pwrite

Parameters

buffer
A byte array containing the data to write. The elements between offset and (offset + count) are written to the stream.
offset
A int that specifies the zero-based byte offset within buffer at which to begin copying bytes to the current stream.
count
A int that specifies the maximum number of bytes to be written to the current stream.
fileOffset
A long specifying the byte offset within the file to begin writing.

Exceptions

TypeReason
ArgumentException(offset + count) is greater than the length of buffer.
ArgumentNullExceptionbuffer is null.
ArgumentOutOfRangeExceptionoffset or count is negative.
NotSupportedException The stream does not support writing.
ObjectDisposedException The stream has been closed.
System.IO.IOException

There is no free space remaining on the file system containing the file. [Mono.Unix.Native.Errno.ENOSPC]

-or-

An I/O error occurred while reading from or writing to the file system. [Mono.Unix.Native.Errno.EIO]

-or-

An attempt was made to write over a disk label area at the beginning of a slice. Use disklabel(8) -W to enable writing on the disk label area. [Mono.Unix.Native.Errno.EROFS]

-or-

The file descriptor is associated with a pipe, socket, or FIFO. [Mono.Unix.Native.Errno.ESPIPE]

Mono.Unix.UnixIOException

An attempt is made to write to a pipe that is not open for reading by any process. [Mono.Unix.Native.Errno.EPIPE]

-or-

An attempt is made to write to a socket of type Mono.Unix.Native.TODO.SOCK_STREAM that is not connected to a peer socket. [Mono.Unix.Native.Errno.EPIPE]

-or-

An attempt was made to write a file that exceeds the process's file size limit or the maximum file size. [Mono.Unix.Native.Errno.EFBIG]

-or-

The user's quota of disk blocks on the file system containing the file has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]

-or-

A signal interrupted the write before it could be completed. [Mono.Unix.Native.Errno.EINTR]

-or-

The file was marked for non-blocking I/O, and no data could be written immediately. [Mono.Unix.Native.Errno.EAGAIN]

-or-

The destination is no longer available when writing to a UNIX domain datagram socket on which Mono.Unix.Native.Syscall.connect(2) had been used to set a destination address. [Mono.Unix.Native.Errno.EDESTADDRREQ]

-or-

The mbuf pool has been completely exhausted when writing to a socket. [Mono.Unix.Native.Errno.ENOBUFS]

Remarks

Unlike System.IO.Stream.Write, this method does not modify System.IO.Stream.Position.

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

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0