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
streamStreamThe source, positioned at the start of the file.
createReaderFunc<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).optionsAvroFileReaderOptionsThe file options, or null for the defaults.
Returns
Type Parameters
TThe 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
streamStreamThe source, positioned at the start of the file.
optionsAvroFileReaderOptionsThe file options, or null for the defaults.
Returns
Type Parameters
TA generated type.
Exceptions
- AvroDataException
The header is malformed.
- AvroException
The file's codec is not available.