Table of Contents

Method OpenAppend

Namespace
AvroSharp.Containers
Assembly
AvroSharp.dll

OpenAppend<T>(Stream, AvroSchema, AvroWriteAction<T>, AvroFileWriterOptions?)

Opens a container file to append to: reads its header, then writes new blocks at its end with the file's sync marker, so the file reads as one. An empty stream becomes a new file, as Create<T>(Stream, AvroSchema, AvroWriteAction<T>, AvroFileWriterOptions?) writes it.

public static AvroFileWriter<T> OpenAppend<T>(Stream stream, AvroSchema schema, AvroWriteAction<T> write, AvroFileWriterOptions? options = null)

Parameters

stream Stream

The file: readable, writable and seekable.

schema AvroSchema

The schema of the objects; it must be the file's (the same canonical form).

write AvroWriteAction<T>

Writes one object in schema's encoding.

options AvroFileWriterOptions

The file options, or null for the defaults. Codec must be the file's codec; the default, the null codec, also stands for the file's when that is null or deflate. Metadata can't be given: the header is already written.

Returns

AvroFileWriter<T>

Type Parameters

T

The type of the objects.

Exceptions

ArgumentException

The stream can't be read, written and seeked, or the options have metadata.

AvroException

The file's schema or codec is not the writer's.

AvroDataException

The file's header is malformed, or the file does not end at a block boundary.

OpenAppend<T>(Stream, AvroFileWriterOptions?)

Opens a container file of a generated type to append to, as OpenAppend<T>(Stream, AvroSchema, AvroWriteAction<T>, AvroFileWriterOptions?) does.

public static AvroFileWriter<T> OpenAppend<T>(Stream stream, AvroFileWriterOptions? options = null) where T : IAvroSerializable<T>

Parameters

stream Stream

The file: readable, writable and seekable.

options AvroFileWriterOptions

The file options, or null for the defaults; see OpenAppend<T>(Stream, AvroSchema, AvroWriteAction<T>, AvroFileWriterOptions?).

Returns

AvroFileWriter<T>

Type Parameters

T

A generated type.

Exceptions

ArgumentException

The stream can't be read, written and seeked, or the options have metadata.

AvroException

The file's schema or codec is not the type's.

AvroDataException

The file's header is malformed.