Show / Hide Table of Contents

Class FileStreamExtensions

A static class that contains extension methods for the System.IO.FileStream class.

Inheritance
System.Object
FileStreamExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Juhta.Net.Extensions
Assembly: Juhta.Net.dll
Syntax
public static class FileStreamExtensions

Methods

| Improve this Doc View Source

Lock(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Copyright © 2017-2019 Juha Lähteenmäki
Generated by DocFX