Class FileIO
TBD
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public static class FileIO
Methods
| Improve this Doc View SourceFromFile(FileInfo, Int32, Int64)
Creates a Source from a Files contents.
Emitted elements are chunkSize
sized ByteString 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<ByteString, Task<IOResult>> FromFile(FileInfo f, int chunkSize = 8192, long startPosition = 0L)
Parameters
Type | Name | Description |
---|---|---|
FileInfo | f | the File to read from |
Int32 | chunkSize | the size of each read operation, defaults to 8192 |
Int64 | startPosition | the start position to read from, defaults to 0 |
Returns
Type | Description |
---|---|
Source<ByteString, Task<IOResult>> | TBD |
ToFile(FileInfo, Nullable<FileMode>, Int64, Boolean, FlushSignaler)
Creates a Sink which writes incoming ByteString 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<ByteString, Task<IOResult>> ToFile(FileInfo f, FileMode? fileMode = null, long startPosition = 0L, bool autoFlush = false, FlushSignaler flushSignaler = null)
Parameters
Type | Name | Description |
---|---|---|
FileInfo | f | the file to write to |
Nullable<FileMode> | fileMode | the write file mode, defaults to OpenOrCreate |
Int64 | startPosition | the start position to write to, defaults to 0 |
Boolean | 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<ByteString, Task<IOResult>> | TBD |