NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MemoryStream Constructor (Byte[], Int32, Int32, Boolean, Boolean)

Initializes a new MemoryStream based on the specified region of a byte array with the CanWrite property set as specified.

[Visual Basic]
Overloads Public Sub New( _
   ByVal buffer() As Byte, _
   ByVal index As Integer, _
   ByVal count As Integer, _
   ByVal writeable As Boolean, _
   ByVal publicallyVisible As Boolean _
)
[C#]
public MemoryStream(
   byte[] buffer,
   int index,
   int count,
   bool writeable,
   bool publicallyVisible
);
[C++]
public: MemoryStream(
   unsigned char* buffer[],
   int index,
   int count,
   bool writeable,
   bool publicallyVisible
);
[JScript]
public function MemoryStream(
   buffer : Byte[],
   index : int,
   count : int,
   writeable : Boolean,
   publicallyVisible : Boolean
);

Parameters

buffer
The array of unsigned bytes from which to create this stream.
index
The index into buffer at which the stream begins.
count
The length of the stream in bytes.
writeable
A flag designating whether the stream supports writing. This argument sets the CanWrite property.
publicallyVisible
true to enable calling GetBuffer; otherwise, false.

Exceptions

Exception Type Condition
ArgumentNullException buffer is null.
ArgumentOutOfRangeException index or count is negative.
ArgumentException The buffer length minus index is less than count.
AccessException publicallyVisible is false.

Remarks

The CanRead and CanSeek properties are both set to true. This constructor can call GetBuffer.

The length of the stream cannot be set to a value greater than the initial length of the specified byte array; however, the stream can be truncated (see SetLength).

See Also

MemoryStream Class | MemoryStream Members | System.IO Namespace | MemoryStream Constructor Overload List