Click or drag to resize

XsFileStream Constructor

X#
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
)
Request Example View Source

Parameters

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
ExceptionCondition
ArgumentNullExceptionpath is .
ArgumentExceptionpath 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.
NotSupportedExceptionpath refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
ArgumentOutOfRangeExceptionbufferSize is negative or zero. -or- mode, access, or share contain an invalid value.
FileNotFoundExceptionThe 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.
IOExceptionAn I/O error, such as specifying FileMode.CreateNew when the file specified by path already exists, occurred. -or- The stream has been closed.
SecurityExceptionThe caller does not have the required permission.
DirectoryNotFoundExceptionThe specified path is invalid, such as being on an unmapped drive.
UnauthorizedAccessExceptionThe 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.
PathTooLongExceptionThe specified path, file name, or both exceed the system-defined maximum length.
See Also