Search Results for

    Show / Hide Table of Contents

    Class DurableFileWriter

    Prevents partial write (e.g. power cut) by writing to a temporary file first. As a final step the following options are supported:

    1. Replacement with taking a backup: It replaces the target file with the temp file using OS Replace API. Replace method also does a backup of the target file first. If the file is corrupted the backup file contains the latest content prior to the crash. https://source.dot.net/#System.Private.CoreLib/FileSystem.Unix.cs

    See more details: https://github.com/dotnet/runtime/issues/18034

    1. Replacement with ReplaceAPI but without a backup: Renaming a file in the same volume is atomic operation. In this mode Replace call uses Interop.Sys.Rename(sourceFullPath, destFullPath) internally.
    Inheritance
    object
    DurableFileWriter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Tenray.ZoneTree.AbstractFileStream
    Assembly: ZoneTree.dll
    Syntax
    public sealed class DurableFileWriter

    Constructors

    | Improve this Doc View Source

    DurableFileWriter(IFileStreamProvider)

    Declaration
    public DurableFileWriter(IFileStreamProvider fileStreamProvider)
    Parameters
    Type Name Description
    IFileStreamProvider fileStreamProvider

    Methods

    | Improve this Doc View Source

    ReadAllBytes(string)

    Declaration
    public byte[] ReadAllBytes(string file)
    Parameters
    Type Name Description
    string file
    Returns
    Type Description
    byte[]
    | Improve this Doc View Source

    ReadAllBytesFromBackup(string)

    Declaration
    public byte[] ReadAllBytesFromBackup(string path)
    Parameters
    Type Name Description
    string path
    Returns
    Type Description
    byte[]
    | Improve this Doc View Source

    ReadAllText(string)

    Declaration
    public string ReadAllText(string file)
    Parameters
    Type Name Description
    string file
    Returns
    Type Description
    string
    | Improve this Doc View Source

    ReadAllTextFromBackup(string)

    Declaration
    public string ReadAllTextFromBackup(string path)
    Parameters
    Type Name Description
    string path
    Returns
    Type Description
    string
    | Improve this Doc View Source

    WriteAllBytes(string, byte[])

    Declaration
    public void WriteAllBytes(string path, byte[] bytes)
    Parameters
    Type Name Description
    string path
    byte[] bytes
    | Improve this Doc View Source

    WriteAllBytesWithBackup(string, byte[])

    Declaration
    public void WriteAllBytesWithBackup(string path, byte[] bytes)
    Parameters
    Type Name Description
    string path
    byte[] bytes
    | Improve this Doc View Source

    WriteAllText(string, string)

    Declaration
    public void WriteAllText(string path, string text)
    Parameters
    Type Name Description
    string path
    string text
    | Improve this Doc View Source

    WriteAllTextWithBackup(string, string)

    Declaration
    public void WriteAllTextWithBackup(string path, string text)
    Parameters
    Type Name Description
    string path
    string text
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2022 Tenray.io