<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified byte array with the CanWrite property set as specified.</div>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.</div>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified, and the ability to call GetBuffer set as specified.</div>
<divclass="block">Writes the entire contents of this memory stream to a java.io.OutputStream.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code>void</code></td>
<tdclass="colLast"><code><strong><ahref="../../System/IO/MemoryStream.html#WriteTo(System.IO.Stream)">WriteTo</a></strong>(<ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a> stream)</code>
<divclass="block">Writes the entire contents of this memory stream to another stream.</div>
<divclass="block">Initializes a new instance of the MemoryStream class with an expandable capacity initialized as specified.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>capacity</code> - The initial size of the internal array in bytes.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - capacity is negative.</dd></dl>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified byte array.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The array of unsigned bytes from which to create the current stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - buffer is null.</dd></dl>
</li>
</ul>
<aname="MemoryStream(byte[], boolean)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>MemoryStream</h4>
<pre>public MemoryStream(byte[] buffer,
boolean writable)</pre>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified byte array with the CanWrite property set as specified.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The array of unsigned bytes from which to create this stream.</dd><dd><code>writable</code> - The setting of the CanWrite property, which determines whether the stream supports writing.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - buffer is null.</dd></dl>
</li>
</ul>
<aname="MemoryStream(byte[], int, int)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>MemoryStream</h4>
<pre>public MemoryStream(byte[] buffer,
int index,
int count)</pre>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified region (index) of a byte array.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The array of unsigned bytes from which to create this stream.</dd><dd><code>index</code> - The index into buffer at which the stream begins.</dd><dd><code>count</code> - The length of the stream in bytes.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<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> - index or count is less than zero.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - The sum of index and count is greater than the length of buffer.</dd></dl>
</li>
</ul>
<aname="MemoryStream(byte[], int, int, boolean)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>MemoryStream</h4>
<pre>public MemoryStream(byte[] buffer,
int index,
int count,
boolean writable)</pre>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The array of bytes from which to create this stream.</dd><dd><code>index</code> - The index into buffer at which the stream begins.</dd><dd><code>count</code> - The length of the stream in bytes.</dd><dd><code>writable</code> - The setting of the CanWrite property, which determines whether the stream supports writing.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<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> - index or count is less than zero.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - The sum of index and count is greater than the length of buffer.</dd></dl>
<divclass="block">Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified, and the ability to call GetBuffer set as specified.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - The array of bytes from which to create this stream.</dd><dd><code>index</code> - The index into buffer at which the stream begins.</dd><dd><code>count</code> - The length of the stream in bytes.</dd><dd><code>writable</code> - The setting of the CanWrite property, which determines whether the stream supports writing.</dd><dd><code>publiclyVisible</code> - true to enable GetBuffer, which returns the byte array from which the stream was created; otherwise, false.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<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> - index or count is less than zero.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code> - The sum of index and count is greater than the length of buffer.</dd></dl>
<divclass="block"><strong>Description copied from class: <code><ahref="../../System/IO/Stream.html#CanRead()">Stream</a></code></strong></div>
<divclass="block">When overridden in a derived class, gets a value indicating whether the current stream supports reading.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#CanRead()">CanRead</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>true if the stream supports reading; otherwise, false.</dd></dl>
</li>
</ul>
<aname="CanSeek()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>CanSeek</h4>
<pre>public boolean CanSeek()</pre>
<divclass="block"><strong>Description copied from class: <code><ahref="../../System/IO/Stream.html#CanSeek()">Stream</a></code></strong></div>
<divclass="block">When overridden in a derived class, gets a value indicating whether the current stream supports seeking.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#CanSeek()">CanSeek</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>true if the stream supports seeking; otherwise, false.</dd></dl>
</li>
</ul>
<aname="CanWrite()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>CanWrite</h4>
<pre>public boolean CanWrite()</pre>
<divclass="block"><strong>Description copied from class: <code><ahref="../../System/IO/Stream.html#CanWrite()">Stream</a></code></strong></div>
<divclass="block">When overridden in a derived class, gets a value indicating whether the current stream supports writing.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#CanWrite()">CanWrite</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>true if the stream supports writing; otherwise, false.</dd></dl>
</li>
</ul>
<aname="getCapacity()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>getCapacity</h4>
<pre>public int getCapacity()</pre>
<divclass="block">Gets the number of bytes allocated for this stream.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>The length of the usable portion of the buffer for the stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream is closed.</dd></dl>
<divclass="block">Sets the number of bytes allocated for this stream.</div>
<dl><dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - A capacity is set that is negative or less than the current length of the stream.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream is closed.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - set is invoked on a stream whose capacity cannot be modified.</dd></dl>
</li>
</ul>
<aname="Length()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Length</h4>
<pre>public long Length()</pre>
<divclass="block"><strong>Description copied from class: <code><ahref="../../System/IO/Stream.html#Length()">Stream</a></code></strong></div>
<divclass="block">When overridden in a derived class, gets the length in bytes of the stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Length()">Length</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>A long value representing the length of the stream in bytes.</dd></dl>
</li>
</ul>
<aname="getPosition()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>getPosition</h4>
<pre>public long getPosition()</pre>
<divclass="block">Gets the current position within the stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#getPosition()">getPosition</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The current position within the stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The stream is closed.</dd></dl>
<divclass="block">Sets the current position within the stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#setPosition(long)">setPosition</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Parameters:</span></dt><dd><code>value</code> - The new position within the stream.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The stream is closed.</dd>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - The position is set to a negative value or a value greater than MaxValue.</dd></dl>
<divclass="block">Releases the unmanaged resources used by the MemoryStream and optionally releases the managed resources.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Dispose(boolean)">Dispose</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<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="Flush()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Flush</h4>
<pre>public void Flush()</pre>
<divclass="block">Overrides Flush so that no action is performed.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Flush()">Flush</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
</dl>
</li>
</ul>
<aname="GetBuffer()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>GetBuffer</h4>
<pre>public byte[] GetBuffer()</pre>
<divclass="block">Returns the array of unsigned bytes from which this stream was created.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>The byte array from which this stream was created, or the underlying array if a byte array was not provided to the MemoryStream constructor during construction of the current instance.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/UnauthorizedAccessException.html"title="class in System">UnauthorizedAccessException</a></code> - The MemoryStream instance was not created with a publicly visible buffer.</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 current stream.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#ReadByte()">ReadByte</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The byte cast to a Int32, or -1 if the end of the stream has been reached.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream instance is closed.</dd></dl>
<divclass="block">Reads a block of bytes from the current stream and writes the data to buffer.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Read(byte[], int, int)">Read</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Parameters:</span></dt><dd><code>buffer</code> - When this method returns, contains the specified byte array with the values between offset and (offset + count - 1) replaced by the characters read from the current stream.</dd><dd><code>offset</code> - The byte offset in buffer at which to begin reading.</dd><dd><code>count</code> - The maximum number of bytes to read.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The total number of bytes written into the buffer. This can be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached before any bytes are read.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream instance is closed.</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/ArgumentException.html"title="class in System">ArgumentException</a></code> - offset subtracted from the buffer length is less than count.</dd></dl>
</li>
</ul>
<aname="Seek(long, System.IO.SeekOrigin)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>Seek</h4>
<pre>public long Seek(long offset,
<ahref="../../System/IO/SeekOrigin.html"title="enum in System.IO">SeekOrigin</a> origin)</pre>
<divclass="block">Sets the position within the current stream to the specified value.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Seek(long, System.IO.SeekOrigin)">Seek</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Parameters:</span></dt><dd><code>offset</code> - The new position within the stream. This is relative to the origin parameter, and can be positive or negative.</dd><dd><code>origin</code> - A value of type SeekOrigin, which acts as the seek reference point.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>The new position within the stream, calculated by combining the initial reference point and the offset.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - offset is greater than MaxValue.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream instance is closed.</dd>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - Seeking is attempted before the beginning of the stream.</dd>
<dd><code><ahref="../../System/ArgumentException.html"title="class in System">ArgumentException</a></code></dd></dl>
<divclass="block">Sets the length of the current stream to the specified value.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#SetLength(long)">SetLength</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Parameters:</span></dt><dd><code>value</code> - The value at which to set the length.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentOutOfRangeException.html"title="class in System">ArgumentOutOfRangeException</a></code> - value is negative or is greater than the maximum length of the MemoryStream, where the maximum length is (MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The current stream is not resizable and value is larger than the current capacity.-or- The current stream does not support writing.</dd></dl>
</li>
</ul>
<aname="ToArray()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>ToArray</h4>
<pre>public byte[] ToArray()</pre>
<divclass="block">Writes the entire stream contents to a byte array, regardless of the Position property.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>A new byte array.</dd></dl>
<divclass="block">Writes a byte to the current stream at the current position.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#WriteByte(byte)">WriteByte</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<dt><spanclass="strong">Parameters:</span></dt><dd><code>value</code> - The byte to write.</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 writing. For additional information see CanWrite.-or- The current position is at the end of the stream, and the capacity cannot be modified.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream is closed.</dd></dl>
<divclass="block">Writes a block of bytes to the current stream using data read from buffer.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><ahref="../../System/IO/Stream.html#Write(byte[], int, int)">Write</a></code> in class <code><ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a></code></dd>
<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 at which to begin writing from.</dd><dd><code>count</code> - The maximum number of bytes to write.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current stream is closed.</dd>
<dd><code><ahref="../../System/NotSupportedException.html"title="class in System">NotSupportedException</a></code> - The stream does not support writing. For additional information see CanWrite.-or- The current position is closer than count bytes to the end of the stream, and the capacity cannot be modified.</dd>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - buffer is null.</dd>
<dd><code><ahref="../../System/IO/IOException.html"title="class in System.IO">IOException</a></code> - An I/O error occurs.</dd></dl>
</li>
</ul>
<aname="WriteTo(System.IO.Stream)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>WriteTo</h4>
<pre>public void WriteTo(<ahref="../../System/IO/Stream.html"title="class in System.IO">Stream</a> stream)</pre>
<divclass="block">Writes the entire contents of this memory stream to another stream.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>stream</code> - The stream to write this memory stream to.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - stream is null.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current or target stream is closed.</dd></dl>
<divclass="block">Writes the entire contents of this memory stream to a java.io.OutputStream.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>stream</code> - The stream to write this memory stream to.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../System/ArgumentNullException.html"title="class in System">ArgumentNullException</a></code> - stream is null.</dd>
<dd><code><ahref="../../System/ObjectDisposedException.html"title="class in System">ObjectDisposedException</a></code> - The current or target stream is closed.</dd></dl>