System.IO.Stream Members

The members of System.IO.Stream are listed below.

See Also: Inherited members from System.MarshalByRefObject

Protected Constructors

Initializes a new instance of the System.IO.Stream class.

Public Fields

static readonly
NullStream.

A Stream with no backing store.

Public Properties

[read-only]
abstract
CanReadbool.

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

[read-only]
abstract
CanSeekbool.

When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

[read-only]
CanTimeoutbool.

Gets a value that determines whether the current stream can time out.

[read-only]
abstract
CanWritebool.

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

[read-only]
abstract
Lengthlong.

When overridden in a derived class, gets the length in bytes of the stream.

abstract
Positionlong.

When overridden in a derived class, gets or sets the position within the current stream.

ReadTimeoutint.

Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.

WriteTimeoutint.

Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.

Public Methods

BeginRead(byte[], int, int, AsyncCallback, object) : IAsyncResult

Begins an asynchronous read operation. (Consider using Stream.ReadAsync(Byte[], int, int) instead; see the Remarks section.)

BeginWrite(byte[], int, int, AsyncCallback, object) : IAsyncResult

Begins an asynchronous write operation. (Consider using Stream.WriteAsync(Byte[], int, int) instead; see the Remarks section.)

Close()

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.

CopyTo(Stream)

Reads the bytes from the current stream and writes them to another stream.

CopyTo(Stream, int)

Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

CopyToAsync(Stream) : System.Threading.Tasks.Task

Asynchronously reads the bytes from the current stream and writes them to another stream.

CopyToAsync(Stream, int) : System.Threading.Tasks.Task

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

CopyToAsync(Stream, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

Dispose()

Releases all resources used by the System.IO.Stream.

EndRead(IAsyncResult) : int

Waits for the pending asynchronous read to complete. (Consider using Stream.ReadAsync(Byte[], int, int) instead; see the Remarks section.)

EndWrite(IAsyncResult)

Ends an asynchronous write operation. (Consider using Stream.WriteAsync(Byte[], int, int) instead; see the Remarks section.)

abstract
Flush()

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync() : System.Threading.Tasks.Task

Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync(System.Threading.CancellationToken) : System.Threading.Tasks.Task

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

abstract
Read(byte[], int, int) : int

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadAsync(byte[], int, int) : System.Threading.Tasks.Task<int>

Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadAsync(byte[], int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<int>

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadByte() : int

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

abstract
Seek(long, SeekOrigin) : long

When overridden in a derived class, sets the position within the current stream.

abstract
SetLength(long)

When overridden in a derived class, sets the length of the current stream.

static
Synchronized(Stream) : Stream

Creates a thread-safe (synchronized) wrapper around the specified System.IO.Stream object.

abstract
Write(byte[], int, int)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteAsync(byte[], int, int) : System.Threading.Tasks.Task

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

WriteAsync(byte[], int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteByte(byte)

Writes a byte to the current position in the stream and advances the position within the stream by one byte.

Protected Methods

CreateWaitHandle() : System.Threading.WaitHandle

Allocates a System.Threading.WaitHandle object.

Dispose(bool)

Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed resources.

ObjectInvariant()

Provides support for a System.Diagnostics.Contracts.Contract.

Explicitly Implemented Interface Members

IDisposable.DisposeImplemented to support the IDisposable interface. [Note: For more information, see IDisposable.Dispose.]