<dd><ahref="../../System/IDisposable.html"title="interface in System">IDisposable</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><ahref="../../System/IO/FileStream.html"title="class in System.IO">FileStream</a>, <ahref="../../System/IO/MemoryStream.html"title="class in System.IO">MemoryStream</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <spanclass="strong">Stream</span>
extends java.lang.Object
implements <ahref="../../System/IDisposable.html"title="interface in System">IDisposable</a></pre>
<divclass="block">Provides a generic view of a sequence of bytes.</div>
<divclass="block">Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed resources.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code>int</code></td>
<tdclass="colLast"><code><strong><ahref="../../System/IO/Stream.html#EndRead(System.IAsyncResult)">EndRead</a></strong>(<ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> asyncResult)</code>
<divclass="block">Waits for the pending asynchronous read to complete.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code>void</code></td>
<tdclass="colLast"><code><strong><ahref="../../System/IO/Stream.html#EndWrite(System.IAsyncResult)">EndWrite</a></strong>(<ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> asyncResult)</code>
<divclass="block">Ends an asynchronous write operation.</div>
<divclass="block">When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.</div>
<divclass="block">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.</div>
<divclass="block">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.</div>
<divclass="block">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.</div>
<divclass="block">When overridden in a derived class, gets the length in bytes of the stream.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>A long value representing the length of the stream in bytes.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - A class derived from Stream does not support seeking.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd></dl>
<pre>public <ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> BeginRead(byte[] buffer,
int offset,
int count,
<ahref="../../System/AsyncCallback.html"title="class in System">AsyncCallback</a> callback,
java.lang.Object state)</pre>
<divclass="block">Begins an asynchronous read operation.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer to read the data into.</dd><dd><code>offset</code> - The byte offset in buffer at which to begin writing data read from the stream.</dd><dd><code>count</code> - The maximum number of bytes to read.</dd><dd><code>callback</code> - An optional asynchronous callback, to be called when the read is complete.</dd><dd><code>state</code> - A user-provided object that distinguishes this particular asynchronous read request from other requests.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>An System.IAsyncResult that represents the asynchronous read, which could still be pending.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - Attempted an asynchronous read past the end of the stream, or a disk error occurs.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - One or more of the arguments is invalid.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The current Stream implementation does not support the read operation.</dd></dl>
<pre>public <ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> BeginWrite(byte[] buffer,
int offset,
int count,
<ahref="../../System/AsyncCallback.html"title="class in System">AsyncCallback</a> callback,
java.lang.Object state)</pre>
<divclass="block">Begins an asynchronous write operation.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer to write data from.</dd><dd><code>offset</code> - The byte offset in buffer from which to begin writing.</dd><dd><code>count</code> - The maximum number of bytes to write.</dd><dd><code>callback</code> - An optional asynchronous callback, to be called when the write is complete.</dd><dd><code>state</code> - A user-provided object that distinguishes this particular asynchronous write request from other requests.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>An IAsyncResult that represents the asynchronous write, which could still be pending.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - Attempted an asynchronous write past the end of the stream, or a disk error occurs.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - One or more of the arguments is invalid.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The current Stream implementation does not support the write operation.</dd></dl>
</li>
</ul>
<aname="Close()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Close</h4>
<pre>public void Close()</pre>
<divclass="block">Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.</div>
</li>
</ul>
<aname="Dispose()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Dispose</h4>
<pre>public void Dispose()</pre>
<divclass="block">Releases all resources used by the System.IO.Stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IDisposable.html#Dispose()">Dispose</a></code> in interface <code><ahref="../../System/IDisposable.html"title="interface in System">IDisposable</a></code></dd>
<divclass="block">Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed resources.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>disposing</code> - true to release both managed and unmanaged resources; false to release only unmanaged resources.</dd></dl>
</li>
</ul>
<aname="EndRead(System.IAsyncResult)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>EndRead</h4>
<pre>public int EndRead(<ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> asyncResult)</pre>
<divclass="block">Waits for the pending asynchronous read to complete.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>asyncResult</code> - The reference to the pending asynchronous request to finish.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The number of bytes read from the stream, between zero (0) and the number of bytes you requested.
<pre>public void EndWrite(<ahref="../../System/IAsyncResult.html"title="interface in System">IAsyncResult</a> asyncResult)</pre>
<divclass="block">Ends an asynchronous write operation.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>asyncResult</code> - The reference to the pending asynchronous request to finish.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - asyncResult is null.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - asyncResult did not originate from a System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object) method on the current stream.</dd>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - The stream is closed or an internal error has occurred.</dd></dl>
</li>
</ul>
<aname="Flush()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Flush</h4>
<pre>public abstract void Flush()</pre>
<divclass="block">When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.</div>
<dl><dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd></dl>
<divclass="block">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.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.</dd><dd><code>offset</code> - The zero-based byte offset in buffer at which to begin storing the data read from the current stream.</dd><dd><code>count</code> - The maximum number of bytes to be read from the current stream.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - The sum of offset and count is larger than the buffer length.</dd>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - buffer is null.</dd>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - offset or count is negative.</dd>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support reading.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd></dl>
</li>
</ul>
<aname="ReadByte()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>ReadByte</h4>
<pre>public int ReadByte()</pre>
<divclass="block">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.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>The unsigned byte cast to an Int32, or -1 if at the end of the stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support reading.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd></dl>
<ahref="../../System/IO/SeekOrigin.html"title="enum in System.IO">SeekOrigin</a> origin)</pre>
<divclass="block">When overridden in a derived class, sets the position within the current stream.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>offset</code> - A byte offset relative to the origin parameter.</dd><dd><code>origin</code> - A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The new position within the current stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support seeking, such as if the stream is constructed from a pipe or console output.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd></dl>
<divclass="block">When overridden in a derived class, sets the length of the current stream.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>value</code> - The desired length of the current stream in bytes.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - Methods were called after the stream was closed.</dd></dl>
<divclass="block">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.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - An array of bytes. This method copies count bytes from buffer to the current stream.</dd><dd><code>offset</code> - The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</dd><dd><code>count</code> - The number of bytes to be written to the current stream.</dd></dl>
<divclass="block">Writes a byte to the current position in the stream and advances the position within the stream by one byte.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>value</code> - The byte to write to the stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support writing, or the stream is already closed.</dd></dl>