UnbufferedFileWriter Class

File writer (consumer) in a transfer operation.

Definition

Namespace: Quine.FileTransfer
Assembly: Quine.FileTransfer (in Quine.FileTransfer.dll) Version: 1.0.0+6efd94d5454131cfac18f827c2a4172cb83f1e24
C#
public class Writer : UnbufferedFile, ITransferConsumer, 
	ITransferWorker
Inheritance
Object    UnbufferedFile    UnbufferedFileWriter
Implements
ITransferConsumer, ITransferWorker

Constructors

UnbufferedFileWriterInitializes a new instance of the UnbufferedFileWriter class

Properties

FilePath Fully-qualified path to the file.
(Inherited from UnbufferedFile)
MaxConcurrency File I/O currently supports only serial operation.
(Inherited from UnbufferedFile)
State Managed by TransferDriver. The implementation should initialize this property to null. The driver injects a valid instance before execution starts. After execution, the instance may be inspected for errors.
(Inherited from UnbufferedFile)

Methods

DrainAsync

Consumes the data in buffer as determined by its Data, and Sequence properties. Failure must be signaled by throwing an exception. This method will be invoked concurrently when MaxConcurrency is greater than 1. The driver stops invoking this method after an error has occurred.

WARNINGS: The data from the buffer MUST be completely consumed. If this rule is not followed, data will be corrupt at the destinations. Do NOT keep a reference to buffer, or any of its members, for later use outside of this method.

FinalizeAsync

Finalizes the worker by computing the verification hash and disposing of any previously acquired resources. Failure must be signaled by throwing an exception. This method is always invoked, once per transfer. It is invoked regardless of whether the worker encountered an error or not (Exception).

IMPORTANT: Resources should be disposed even if cancellation is requested.


(Inherited from UnbufferedFile)
InitializeAsync Initializes the worker for the next transfer, acquiring any needed resources. Failure must be signaled by throwing an exception. This method is always invoked, once per transfer.
(Inherited from UnbufferedFile)

See Also