Class AvroFileWriter<T>
- Namespace
- AvroSharp.Containers
- Assembly
- AvroSharp.dll
Writes an Avro object container file: a header holding the schema, then blocks of objects, each compressed with the file's codec and followed by the sync marker. Objects are buffered until a block reaches SyncInterval or 65,536 objects; Flush() and Dispose() write the rest. The header is written with the first block, or when the writer is flushed or disposed. The asynchronous members (WriteAsync(T, CancellationToken), FlushAsync(CancellationToken), DisposeAsync()) do no synchronous I/O.
public sealed class AvroFileWriter<T> : IDisposable, IAsyncDisposable
Type Parameters
TThe type of the objects.
- Inheritance
-
AvroFileWriter<T>
- Implements
- Inherited Members
Remarks
Instances are not thread-safe.
Properties
- Schema
Gets the schema of the objects.
Methods
- Dispose()
Writes the buffered objects, flushes the stream and, unless the options say otherwise, disposes it.
- DisposeAsync()
Writes the buffered objects, flushes the stream and, unless the options say otherwise, disposes it, all asynchronously.
- Flush()
Writes the buffered objects as a block, if there are any, and flushes the stream.
- FlushAsync(CancellationToken)
Writes the buffered objects as a block, if there are any, and flushes the stream, asynchronously.
- Write(T)
Appends one object, writing a block when the buffered objects reach the sync interval.
- WriteAsync(T, CancellationToken)
Appends one object; when the buffered objects reach the sync interval, the block is written to the stream asynchronously. The object itself is encoded synchronously, into memory.