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!

FileStream Constructor (Int32, FileAccess, Boolean, Boolean, Int32)

Initializes a new instance of the FileStream object for the specified file handle, with the specified read/write permission, FileStream instance ownership, synchronous or asynchronous state, and buffer size.

[Visual Basic]
Overloads Public Sub New( _
   ByVal handle As Integer, _
   ByVal access As FileAccess, _
   ByVal ownsHandle As Boolean, _
   ByVal isAsync As Boolean, _
   ByVal bufferSize As Integer _
)
[C#]
public FileStream(
   int handle,
   FileAccess access,
   bool ownsHandle,
   bool isAsync,
   int bufferSize
);
[C++]
public: FileStream(
   int handle,
   FileAccess access,
   bool ownsHandle,
   bool isAsync,
   int bufferSize
);
[JScript]
public function FileStream(
   handle : int,
   access : FileAccess,
   ownsHandle : Boolean,
   isAsync : Boolean,
   bufferSize : int
);

Parameters

handle
A file handle for the file that this FileStream object will encapsulate.
access
A FileAccess constant that determines how the file may be accessed by the FileStream object. This sets the CanRead and CanWrite properties of the FileStream object. CanSeek is set to true if path specifies a disk file.
ownsHandle
true if the file handle will be owned by this FileStream instance; otherwise, false.
isAsync
true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false.
bufferSize
The size of the buffer in bytes.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException access is less than FileAccess.Read or greater than FileAccess.ReadWrite or bufferSize is negative.
ArgumentException The handle is invalid.
IOException An I/O error occurs.
SecurityException The caller does not have the required permission.
ExecutionEngineException ThreadPoolBindHandle failed.

Requirements

NGWS Runtime Security:

FileIOPermissionAccess Read flag required by FileAccess.Read and FileAccess.ReadWrite.
FileIOPermissionAccess Write flag required by FileAccess.Write and FileAccess.ReadWrite.

See Also

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