/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size, and synchronous or asynchronous state. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> /// <param name="isAsync"> true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param> public IFileStream Create(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { return(new FileStreamWrap(handle, access, bufferSize, isAsync)); }
public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { Initialize(handle, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize) { Initialize(handle, access, bufferSize); }
/// <summary>Initializes a new instance of the <see cref="FileStream" /> class for the specified file handle, with the specified read/write permission, and buffer size.</summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A <see cref="T:System.IO.FileAccess" /> constant that sets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param> /// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. The default buffer size is 4096.</param> /// <exception cref="T:System.ArgumentException">The <paramref name="handle" /> parameter is an invalid handle.-or-The <paramref name="handle" /> parameter is a synchronous handle and it was used asynchronously. </exception> /// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="bufferSize" /> parameter is negative. </exception> /// <exception cref="T:System.IO.IOException">An I/O error, such as a disk error, occurred.-or-The stream has been closed. </exception> /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> /// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception> public FileStreamAdapter([NotNull] ISafeFileHandle handle, FileAccess access, int bufferSize) : this(handle.ToImplementation(), access, bufferSize) { }
public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { Initialize(handle, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:UnitWrappers.System.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access) { _underlyingObject = new FileStream(handle.UnderlyingObject, access); }
/// <summary> /// Creates a new instance of the <see cref='IFileStream'/> class passing the byte buffer. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <returns> /// The <see cref="IFileStream"/>. /// </returns> public IFileStream Create(ISafeFileHandle handle, FileAccess access) { return new FileStreamWrap(handle, access); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public void Initialize(ISafeFileHandle handle, FileAccess access) { FileStreamInstance = new FileStream(handle.SafeFileHandleInstance, access); }
/// <summary> /// Initializes a new instance of the <see cref="T:UnitWrappers.System.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size, and synchronous or asynchronous state. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> /// <param name="isAsync"> true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param> // [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { _underlyingObject = new FileStream(((IWrap <global::Microsoft.Win32.SafeHandles.SafeFileHandle>)handle).UnderlyingObject, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:UnitWrappers.System.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access) { _underlyingObject = new FileStream(((IWrap <global::Microsoft.Win32.SafeHandles.SafeFileHandle>)handle).UnderlyingObject, access); }
public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { FileStreamInstance = new FileStream(handle.UnderlyingObject, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:UnitWrappers.System.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access) { FileStreamInstance = new FileStream(handle.UnderlyingObject, access); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public void Initialize(ISafeFileHandle handle, FileAccess access) { FileStreamInstance = new FileStream(handle.SafeFileHandleInstance, access); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access) { Initialize(handle, access); }
public void Initialize(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { FileStreamInstance = new FileStream(handle.SafeFileHandleInstance, access, bufferSize, isAsync); }
public void Initialize(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { FileStreamInstance = new FileStream(handle.SafeFileHandleInstance, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access) { Initialize(handle, access); }
/// <summary>Initializes a new instance of the <see cref="FileStream" /> class for the specified file handle, with the specified read/write permission. </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A constant that sets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param> /// <exception cref="T:System.ArgumentException"> /// <paramref name="access" /> is not a field of <see cref="T:System.IO.FileAccess" />. </exception> /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> /// <exception cref="T:System.IO.IOException">An I/O error, such as a disk error, occurred.-or-The stream has been closed. </exception> /// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception> public FileStreamAdapter(ISafeFileHandle handle, FileAccess access) : this(new FileStream(handle.ToImplementation <SafeFileHandle>(), access)) { }
/// <summary> /// Converts provided <see cref="ISafeFileHandle"/> info to <see cref="SafeFileHandle"/>. /// </summary> /// <param name="abstraction">Instance of <see cref="ISafeFileHandle"/> to convert.</param> /// <returns>An instance of <see cref="SafeFileHandle"/>.</returns> public static SafeFileHandle ToImplementation(this ISafeFileHandle abstraction) { return(((IAbstraction <SafeFileHandle>)abstraction)?.UnsafeConvert()); }
/// <summary>Initializes a new instance of the <see cref="FileStream" /> class for the specified file handle, with the specified read/write permission, buffer size, and synchronous or asynchronous state.</summary> /// <param name="handle">A file handle for the file that this FileStream object will encapsulate. </param> /// <param name="access">A constant that sets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param> /// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. The default buffer size is 4096.</param> /// <param name="isAsync">true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param> /// <exception cref="T:System.ArgumentException">The <paramref name="handle" /> parameter is an invalid handle.-or-The <paramref name="handle" /> parameter is a synchronous handle and it was used asynchronously. </exception> /// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="bufferSize" /> parameter is negative. </exception> /// <exception cref="T:System.IO.IOException">An I/O error, such as a disk error, occurred.-or-The stream has been closed. </exception> /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> /// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception> public FileStreamAdapter(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) : this(new FileStream(handle.ToImplementation <SafeFileHandle>(), access, bufferSize, isAsync)) { }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> public IFileStream Create(ISafeFileHandle handle, FileAccess access, int bufferSize) { return new FileStreamWrap(handle, access, bufferSize); }
/// <summary> /// Creates a new instance of the <see cref='IFileStream'/> class passing the byte buffer. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <returns> /// The <see cref="IFileStream"/>. /// </returns> public IFileStream Create(ISafeFileHandle handle, FileAccess access) { return(new FileStreamWrap(handle, access)); }
/// <summary> /// Initializes a new instance of the <see cref="T:UnitWrappers.System.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size, and synchronous or asynchronous state. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> /// <param name="isAsync"> true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param> // [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { _underlyingObject = new FileStream(handle.UnderlyingObject, access, bufferSize, isAsync); }
/// <summary> /// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size. /// </summary> /// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param> /// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param> /// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param> public FileStreamWrap(ISafeFileHandle handle, FileAccess access, int bufferSize) { Initialize(handle, access, bufferSize); }