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)

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

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

Parameters

handle
A file handle for the file that the current 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.

Exceptions

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

Remarks

This constructor calls FileStream(int handle, FileAccess access, bool ownsHandle, int bufferSize), sets ownsHandle to true (this process owns the file handle), and sets bufferSize to 8192 bytes (8 KB). When Close is called, the handle is also closed and the file's handle count is decremented.

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