Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System.IO Namespace
Stream Class
 Stream Members
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Stream Members

Provides a generic view of a sequence of bytes.

The Stream type exposes the following members.

  NameDescription
skadfeka.protmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifStream Initializes a new instance of the Stream class.
Top
  NameDescription
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifBeginRead Begins an asynchronous read operation.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifBeginWrite Begins an asynchronous write operation.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifClose Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.
skadfeka.pubmethod(en-us,VS.90).gifCreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
skadfeka.protmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifCreateWaitHandle Obsolete. Allocates a WaitHandle object.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifDisposeOverloaded. Releases all resources used by the Stream object.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifEndRead Waits for the pending asynchronous read to complete.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifEndWrite Ends an asynchronous write operation.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifEquals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
skadfeka.protmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifFinalize Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifFlush When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifGetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
skadfeka.pubmethod(en-us,VS.90).gifGetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifGetType Gets the Type of the current instance. (Inherited from Object.)
skadfeka.pubmethod(en-us,VS.90).gifInitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
skadfeka.protmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifMemberwiseCloneOverloaded.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifRead 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.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifReadByte 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.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifSeek When overridden in a derived class, sets the position within the current stream.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifSetLength When overridden in a derived class, sets the length of the current stream.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.static(en-us,VS.90).gifSynchronized Creates a thread-safe (synchronized) wrapper around the specified Stream object.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifToString Returns a String that represents the current Object. (Inherited from Object.)
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifWrite 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.
skadfeka.pubmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifWriteByte Writes a byte to the current position in the stream and advances the position within the stream by one byte.
Top
  NameDescription
skadfeka.pubfield(en-us,VS.90).gifskadfeka.static(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifNull A Stream with no backing store.
Top
  NameDescription
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifCanRead When overridden in a derived class, gets a value indicating whether the current stream supports reading.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifCanSeek When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifCanTimeout Gets a value that determines whether the current stream can time out.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifCanWrite When overridden in a derived class, gets a value indicating whether the current stream supports writing.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifLength When overridden in a derived class, gets the length in bytes of the stream.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifPosition When overridden in a derived class, gets or sets the position within the current stream.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifReadTimeout Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out.
skadfeka.pubproperty(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifskadfeka.xna(en-us,VS.90).gifWriteTimeout Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out.
Top
  NameDescription
skadfeka.pubinterface(en-us,VS.90).gifskadfeka.privmethod(en-us,VS.90).gifskadfeka.CFW(en-us,VS.90).gifIDisposable..::.Dispose For a description of this member, see IDisposable..::.Dispose.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Suggestion      G1   |   Edit   |  

1) Stream uses integer -1 as an end of stream indicator for the ReadByte() method. Consequently, this constant should exist somewhere in the library and ideally as a readonly field or property of stream itself. Consequently, the following becomes doable...

for (int b in myStream.ReadByte(); b != myStream.EndOfStream; b = myStream.ReadByte())

otherStream.WriteByte( (byte) b );

2) Another suggestion is to have inter-stream methods for the sake of completeness and intuitivity, as follows:

aStream.WriteAll( bStream );

and

aStream.ReadAll( bStream );

and

class Stream<T> : IEnumerable<T>

and

....

3) There is just such a lack of symmetry...thank goodness for extension methods....Sealed classes was definitely a mistake (sealed features if you must, but to seal the entire class is to kill the goose the lays the gold eggs).

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker