Show / Hide Table of Contents

Interface IFileHandler

This interface is used to inject the Regular File handler or one that can be used for unit testing.

Namespace: ivrToolkit.Core.Interfaces
Assembly: ivrToolkit.Core.dll
Syntax
public interface IFileHandler

Methods

| Edit this page View Source

Exists(string)

Checks to see if the path exists.

Declaration
bool Exists(string fullPath)
Parameters
Type Name Description
string fullPath

The name of the path to check

Returns
Type Description
bool

True if the path exists

| Edit this page View Source

GetFileStream(string, FileMode, FileAccess, FileShare)

Returns the files stream for the given file.

Declaration
Stream GetFileStream(string fileName, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
Parameters
Type Name Description
string fileName

The name of the file to read from

FileMode fileMode
FileAccess fileAccess
FileShare fileShare
Returns
Type Description
Stream

A Stream containing the contents

| Edit this page View Source

ReadAllTextAsync(string, CancellationToken)

Reads the contents of a file as one long string

Declaration
Task<string> ReadAllTextAsync(string fileName, CancellationToken cancellationToken)
Parameters
Type Name Description
string fileName

THe name of the file to read from

CancellationToken cancellationToken

A token to monitor for cancellation requests.

Returns
Type Description
Task<string>

The contents of the file as a string

| Edit this page View Source

WriteAllBytesAsync(string, byte[], CancellationToken)

Writes out a byte array to a file

Declaration
Task WriteAllBytesAsync(string fileName, byte[] bytes, CancellationToken cancellationToken)
Parameters
Type Name Description
string fileName

The name of the file to write out

byte[] bytes

The byte array to write into the file

CancellationToken cancellationToken

A token to monitor for cancellation requests.

Returns
Type Description
Task
| Edit this page View Source

WriteAllTextAsync(string, string, CancellationToken)

Write out a text string to a file

Declaration
Task WriteAllTextAsync(string fileName, string text, CancellationToken cancellationToken)
Parameters
Type Name Description
string fileName

The name of the file to write out

string text

The text string to write into the file

CancellationToken cancellationToken

A token to monitor for cancellation requests.

Returns
Type Description
Task

Extension Methods

ValidationExtensions.ThrowIfNull<T>(T, string)
  • View Source
In this article
Back to top Generated by DocFX