Table of Contents

Method Open

Namespace
AvroSharp.Containers
Assembly
AvroSharp.dll

Open<T>(Stream, Func<AvroSchema, AvroReadFunc<T>>, AvroFileReaderOptions?)

Reads a file's header and returns a reader of its objects.

public static AvroFileReader<T> Open<T>(Stream stream, Func<AvroSchema, AvroReadFunc<T>> createReader, AvroFileReaderOptions? options = null)

Parameters

stream Stream

The source, positioned at the start of the file.

createReader Func<AvroSchema, AvroReadFunc<T>>

Called once with the file's schema; returns the function that reads one object. For a generated type whose schema may differ from the file's, return a function calling its Read(ref reader, writerSchema).

options AvroFileReaderOptions

The file options, or null for the defaults.

Returns

AvroFileReader<T>

Type Parameters

T

The type of the objects.

Exceptions

AvroDataException

The header is malformed.

AvroException

The file's codec is not available.

Open<T>(Stream, AvroFileReaderOptions?)

Opens a container file of a generated type, reading data of another version of its schema by resolution.

public static AvroFileReader<T> Open<T>(Stream stream, AvroFileReaderOptions? options = null) where T : IAvroSerializable<T>

Parameters

stream Stream

The source, positioned at the start of the file.

options AvroFileReaderOptions

The file options, or null for the defaults.

Returns

AvroFileReader<T>

Type Parameters

T

A generated type.

Exceptions

AvroDataException

The header is malformed.

AvroException

The file's codec is not available.