Class MemoryFileLocator
An in memory file locator.
Inherited Members
Namespace: JeremyAnsel.IO.Locator
Assembly: JeremyAnsel.IO.Locator.dll
Syntax
public sealed class MemoryFileLocator : IFileLocator, IWritableFileLocator, IDisposable
Constructors
| Edit this page View SourceMemoryFileLocator()
Initializes a new instance of the MemoryFileLocator class.
Declaration
public MemoryFileLocator()
Properties
| Edit this page View SourceIsEmpty
Gets a value indicating whether the file locator is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceClear()
Clears the file locator.
Declaration
public void Clear()
Create(string?)
Create a file.
Declaration
public void Create(string? path)
Parameters
Type | Name | Description |
---|---|---|
string | path | A path. |
Dispose()
Immediately releases the unmanaged resources used by the MemoryFileLocator object.
Declaration
public void Dispose()
EnumerateFiles()
Enumerate the files.
Declaration
public IEnumerable<string> EnumerateFiles()
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumeration. |
EnumerateFiles(string)
Enumerate the files.
Declaration
public IEnumerable<string> EnumerateFiles(string root)
Parameters
Type | Name | Description |
---|---|---|
string | root | The root path. |
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumeration. |
Exists(string)
Indicates whether the specified path exists.
Declaration
public bool Exists(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | A path. |
Returns
Type | Description |
---|---|
bool | A boolean. |
Open(string)
Open a file.
Declaration
public Stream Open(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | A path. |
Returns
Type | Description |
---|---|
Stream | A stream. |
Write(string, Stream?)
Write a file.
Declaration
public void Write(string path, Stream? data)
Parameters
Type | Name | Description |
---|---|---|
string | path | A path. |
Stream | data | The data. |
WriteAll(IFileLocator?)
Write the files from a file locator.
Declaration
public void WriteAll(IFileLocator? locator)
Parameters
Type | Name | Description |
---|---|---|
IFileLocator | locator | A file locator. |
WriteAll(IFileLocator?, string)
Write the files from a file locator.
Declaration
public void WriteAll(IFileLocator? locator, string root)
Parameters
Type | Name | Description |
---|---|---|
IFileLocator | locator | A file locator. |
string | root | The root path. |