XsFileStream Constructor | |
Initializes a new instance of the
FileStream class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, and additional file options.
Namespace:
XSharp.IO
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax CONSTRUCTOR(
path AS STRING,
mode AS FileMode,
faccess AS FileAccess,
share AS FileShare,
bufferSize AS LONG,
options AS FileOptions
)
public XsFileStream(
string path,
FileMode mode,
FileAccess faccess,
FileShare share,
int bufferSize,
FileOptions options
)
Request Example
View SourceParameters
- path
- Type: String
A relative or absolute path for the file that the current FileStream object will encapsulate. - mode
- Type: FileMode
A constant that determines how to open or create the file. - faccess
- Type: FileAccess
- share
- Type: FileShare
A constant that determines how the file will be shared by processes. - bufferSize
- Type: Long
A positive Long value greater than 0 indicating the buffer size. The default buffer size is 4096. - options
- Type: FileOptions
A value that specifies additional file options.
Exceptions Exception | Condition |
---|
ArgumentNullException | path is . |
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. |
ArgumentOutOfRangeException | bufferSize is negative or zero.
-or-
mode, access, or share contain an invalid value. |
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, such as specifying FileMode.CreateNew when the file specified by path already exists, occurred.
-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.
-or-
Encrypted is specified for options, but file encryption is not supported on the current platform. |
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. |
See Also