Search Results for

    Show / Hide Table of Contents

    Class FileIO

    TBD

    Inheritance
    object
    FileIO
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Streams.Dsl
    Assembly: Akka.Streams.dll
    Syntax
    public static class FileIO

    Methods

    | Edit this page View Source

    FromFile(FileInfo, int, long)

    Creates a Source from a Files contents. Emitted elements are chunkSize sized ReadOnlySequence<byte> elements, except the final element, which will be up to chunkSize in size.

    You can configure the default dispatcher for this Source by changing the "akka.stream.blocking-io-dispatcher" or set it for a given Source by using ActorAttributes.

    It materializes a Task<TResult> of IOResult containing the number of bytes read from the source file upon completion, and a possible exception if IO operation was not completed successfully.

    Declaration
    public static Source<ReadOnlySequence<byte>, Task<IOResult>> FromFile(FileInfo f, int chunkSize = 8192, long startPosition = 0)
    Parameters
    Type Name Description
    FileInfo f

    the File to read from

    int chunkSize

    the size of each read operation, defaults to 8192

    long startPosition

    the start position to read from, defaults to 0

    Returns
    Type Description
    Source<ReadOnlySequence<byte>, Task<IOResult>>

    TBD

    | Edit this page View Source

    ToFile(FileInfo, FileMode?, long, bool, FlushSignaler)

    Creates a Sink which writes incoming ReadOnlySequence<byte> elements to the given file. Overwrites existing files by truncating their contents as default.

    Materializes a Task<TResult> of IOResult that will be completed with the size of the file(in bytes) at the streams completion, and a possible exception if IO operation was not completed successfully.

    This source is backed by an Actor which will use the dedicated "akka.stream.blocking-io-dispatcher", unless configured otherwise by using ActorAttributes.

    Declaration
    public static Sink<ReadOnlySequence<byte>, Task<IOResult>> ToFile(FileInfo f, FileMode? fileMode = null, long startPosition = 0, bool autoFlush = false, FlushSignaler flushSignaler = null)
    Parameters
    Type Name Description
    FileInfo f

    the file to write to

    FileMode? fileMode

    the write file mode, defaults to OpenOrCreate

    long startPosition

    the start position to write to, defaults to 0

    bool autoFlush

    when set, auto flush the file buffer to disk for every incoming element

    FlushSignaler flushSignaler

    when passed an instance of FlushSignaler, can be used to send a manual flush signal to the file sink

    Returns
    Type Description
    Sink<ReadOnlySequence<byte>, Task<IOResult>>

    TBD

    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET