Class FileStreamExtensions
A static class that contains extension methods for the System.IO.FileStream class.
Inheritance
Inherited Members
Namespace: Juhta.Net.Extensions
Assembly: Juhta.Net.dll
Syntax
public static class FileStreamExtensions
Methods
| Improve this Doc View SourceLock(FileStream, Int32)
Locks the file specified by this FileStream instance.
Declaration
public static void Lock(this FileStream fileStream, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileStream | fileStream | Specifies the current FileStream instance. |
System.Int32 | timeout | Specifies a timeout in milliseconds for the operation. |
Lock(FileStream, Int64, Int64, Int32)
Locks a range of the file specified by this FileStream instance.
Declaration
public static void Lock(this FileStream fileStream, long position, long length, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileStream | fileStream | Specifies the current FileStream instance. |
System.Int64 | position | Specifies the position of a range to lock. |
System.Int64 | length | Specifies the length in bytes of a range to lock. |
System.Int32 | timeout | Specifies a timeout in milliseconds for the operation. |
TryLock(FileStream, Int32)
Tries to lock the file specified by this FileStream instance.
Declaration
public static bool TryLock(this FileStream fileStream, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileStream | fileStream | Specifies the current FileStream instance. |
System.Int32 | timeout | Specifies a timeout in milliseconds for the operation. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if a lock to the file was aqcuired within the specified timeout, otherwise false. |
TryLock(FileStream, Int64, Int64, Int32)
Tries to lock a range of the file specified by this FileStream instance.
Declaration
public static bool TryLock(this FileStream fileStream, long position, long length, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileStream | fileStream | Specifies the current FileStream instance. |
System.Int64 | position | Specifies the position of a range to lock. |
System.Int64 | length | Specifies the length in bytes of a range to lock. |
System.Int32 | timeout | Specifies a timeout in milliseconds for the operation. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if a lock to the range of the file was aqcuired within the specified timeout, otherwise false. |