Class FileSystemFile
Represents a file in a file system. This class is NOT thread-safe
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)
    
  Namespace: NFX.IO.FileSystem
Assembly: NFX.dll
Syntax
public sealed class FileSystemFile : FileSystemSessionItem, IDisposable, INamed
  Constructors
FileSystemFile(FileSystemSession, String, String, IFileSystemHandle)
Internal method that should not be called by developers
Declaration
public FileSystemFile(FileSystemSession session, string parentPath, string name, IFileSystemHandle handle)
  Parameters
| Type | Name | Description | 
|---|---|---|
| FileSystemSession | session | |
| System.String | parentPath | |
| System.String | name | |
| IFileSystemHandle | handle | 
Properties
FileStream
Returns a stream usable for file content access. If the file has not opened stream yet it will be opened and cached
Declaration
public FileSystemStream FileStream { get; }
  Property Value
| Type | Description | 
|---|---|
| FileSystemStream | 
Methods
Destructor()
Declaration
protected override void Destructor()
  Overrides
ReadAllText()
Reads all text from file using byte order mark detection with UTF8 encoding
Declaration
public string ReadAllText()
  Returns
| Type | Description | 
|---|---|
| System.String | 
ReadAllText(Encoding, Boolean, Int32)
Reads all text from stream using the specified parameters
Declaration
public string ReadAllText(Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize = 1024)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Text.Encoding | encoding | |
| System.Boolean | detectEncodingFromByteOrderMarks | |
| System.Int32 | bufferSize | 
Returns
| Type | Description | 
|---|---|
| System.String | 
ReadAllTextAsync()
Async version of ReadAllText()
Declaration
public Task<string> ReadAllTextAsync()
  Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.String> | 
ReadAllTextAsync(Encoding, Boolean, Int32)
Async version of ReadAllText(Encoding, Boolean, Int32)
Declaration
public Task<string> ReadAllTextAsync(Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize = 1024)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Text.Encoding | encoding | |
| System.Boolean | detectEncodingFromByteOrderMarks | |
| System.Int32 | bufferSize | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.String> | 
WriteAllText(String)
Sets file content to supplied string using default UTF8 encoding
Declaration
public void WriteAllText(string text)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | 
WriteAllText(String, Encoding, Int32)
Sets file content to supplied string using the specified parameters
Declaration
public void WriteAllText(string text, Encoding encoding, int bufferSize = 1024)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | |
| System.Text.Encoding | encoding | |
| System.Int32 | bufferSize | 
WriteAllTextAsync(String)
Async version of WriteAllText(String)
Declaration
public Task WriteAllTextAsync(string text)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
WriteAllTextAsync(String, Encoding, Int32)
Async version of WriteAllText(String, Encoding, Int32)
Declaration
public Task WriteAllTextAsync(string text, Encoding encoding, int bufferSize = 1024)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | |
| System.Text.Encoding | encoding | |
| System.Int32 | bufferSize | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
Implements
      System.IDisposable