FileStream(String, FileMode, FileAccess, FileShare) Constructor |
Initializes a new instance of the CrestronIO.FileStream class with the specified
path, creation mode, read/write permission, and sharing permission.
Namespace: Crestron.SimplSharp.CrestronIOAssembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntaxpublic FileStream(
string path,
FileMode mode,
FileAccess access,
FileShare share
)
Parameters
- path String
-
A relative or absolute path for the file that the current FileStream object
will encapsulate.
- mode FileMode
-
A CrestronIO.FileMode constant that determines how to open or create the file.
- access FileAccess
-
A CrestronIO.FileAccess constant that determines how the file can be accessed
by the FileStream object. This gets the CrestronIO.FileStream.CanRead and
CrestronIO.FileStream.CanWrite properties of the FileStream object. CrestronIO.FileStream.CanSeek
is true if path specifies a disk file.
- share FileShare
-
A CrestronIO.FileShare constant that determines how the file will be shared
by processes.
Exceptions| Exception | Condition |
|---|
| ArgumentNullException |
path is null.
|
| ArgumentException |
path is an empty string (""), contains only white space, or contains one
or more invalid characters. -or-path refers to a non-file device, such as
"con:", "com1:", "lpt1:", etc. in an NTFS environment.
|
| NotSupportedException |
path refers to a non-file device, such as "con:", "com1:", "lpt1:", etc.
in a non-NTFS environment.
|
| ArgumentException |
path is an empty string (""), contains only white space, or contains one
or more invalid characters.
|
| FileNotFoundException |
The file cannot be found, such as when mode is FileMode.Truncate or FileMode.Open,
and the file specified by path does not exist. The file must already exist
in these modes.
|
| IOException |
An I/O error occurs, such as specifying FileMode.CreateNew and the file specified
by path already exists. -or-The system is running Windows 98 or Windows 98
Second Edition and share is set to FileShare.Delete.-or-The stream has been
closed.
|
| SecurityException |
The caller does not have the required permission.
|
| DirectoryNotFoundException |
The specified path is invalid, such as being on an unmapped drive.
|
| UnauthorizedAccessException |
The access requested is not permitted by the operating system for the specified
path, such as when access is Write or ReadWrite and the file or directory
is set for read-only access.
|
| PathTooLongException |
The specified path, file name, or both exceed the system-defined maximum
length. For example, on Windows-based platforms, paths must be less than
248 characters, and file names must be less than 260 characters.
|
| ArgumentOutOfRangeException |
mode contains an invalid value.
|
| UnauthorizedAccessException | The access requested is not permitted for the specified file. |
Version Information
.NET
Supported in: 6.0
.NET Compact Framework
Supported in: 3.5
See Also