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)

Initializes a new instance of the FileStream object for the specified file handle, with the specified read/write permission and FileStream instance ownership.

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

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.

Exceptions

Exception Type Condition
ArgumentException access is not a field of FileAccess.
SecurityException The caller does not have the required FileIOPermission.

Remarks

The FileStream object is given the specified access to the file. The ownership of the handle will be as specified. If this process owns the handle, a call to the Close method will also close the handle. In particular, the file's handle count is decremented. The FileStream object is given a buffer size of 8192 bytes.

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