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
streamStreamThe file: readable, writable and seekable.
schemaAvroSchemaThe schema of the objects; it must be the file's (the same canonical form).
writeAvroWriteAction<T>Writes one object in
schema's encoding.optionsAvroFileWriterOptionsThe 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
Type Parameters
TThe 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
streamStreamThe file: readable, writable and seekable.
optionsAvroFileWriterOptionsThe file options, or null for the defaults; see OpenAppend<T>(Stream, AvroSchema, AvroWriteAction<T>, AvroFileWriterOptions?).
Returns
Type Parameters
TA 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.