Avro C#
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Avro.File.DataFileWriter< T > Class Template Reference

Stores in a file a sequence of data conforming to a schema. The schema is stored in the file with the data. Each datum in a file is of the same schema. Data is written with a DatumWriter<T>. Data is grouped into blocks. A synchronization marker is written between blocks, so that files may be split. Blocks may be compressed. Extensible metadata is stored at the end of the file. Files may be appended to. More...

Inheritance diagram for Avro.File.DataFileWriter< T >:
Avro.File.IFileWriter< T >

Public Member Functions

bool IsReservedMeta (string key)
 Returns true if parameter is a reserved Avro metadata value.
Parameters
keyMetadata key.
Returns
True if parameter is a reserved Avro metadata value, false otherwise.

 
void SetMeta (string key, byte[] value)
 Set metadata pair.
Parameters
keyMetadata key.
valueMetadata value.

 
void SetMeta (string key, long value)
 Set metadata pair (long value).
Parameters
keyMetadata key.
valueMetadata value.

 
void SetMeta (string key, string value)
 Set metadata pair (string value).
Parameters
keyMetadata key.
valueMetadata value.

 
void SetSyncInterval (int syncInterval)
 Set the synchronization interval for this file or stream, in bytes. Valid values range from 32 to 2^30. Suggested values are between 2K and 2M.
Parameters
syncIntervalApproximate number of uncompressed bytes to write in each block.

 
void Append (T datum)
 Append datum to a file or stream.
Parameters
datumDatum to append.

 
void Flush ()
 Flush out any buffered data.
 
long Sync ()
 Forces the end of the current block, emitting a synchronization marker.
Returns
Current position as a value that may be passed to IFileReader<T>.Seek(long).

 
void Close ()
 Closes the file or stream.
 
void Dispose ()
 

Static Public Member Functions

static IFileWriter< T > OpenWriter (DatumWriter< T > writer, string path)
 Open a new writer instance to write to a file path, using a Null codec.
 
static IFileWriter< T > OpenWriter (DatumWriter< T > writer, Stream outStream)
 Open a new writer instance to write to an output stream, using a Null codec.
 
static IFileWriter< T > OpenWriter (DatumWriter< T > writer, Stream outStream, bool leaveOpen)
 Open a new writer instance to write to an output stream, using a Null codec.
 
static IFileWriter< T > OpenWriter (DatumWriter< T > writer, string path, Codec codec)
 Open a new writer instance to write to a file path with a specified codec.
 
static IFileWriter< T > OpenWriter (DatumWriter< T > writer, Stream outStream, Codec codec)
 Open a new writer instance to write to an output stream with a specified codec.
 
static IFileWriter< T > OpenWriter (DatumWriter< T > writer, Stream outStream, Codec codec, bool leaveOpen)
 Open a new writer instance to write to an output stream with a specified codec.
 
static IFileWriter< T > OpenAppendWriter (DatumWriter< T > writer, string path)
 Open a new writer instance to append to a file path.
 
static IFileWriter< T > OpenAppendWriter (DatumWriter< T > writer, Stream inStream, Stream outStream)
 Open a new writer instance to append to an output stream. Both in and out streams must point to the same file.
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Releases resources associated with this DataFileWriter<T>.
 

Detailed Description

Stores in a file a sequence of data conforming to a schema. The schema is stored in the file with the data. Each datum in a file is of the same schema. Data is written with a DatumWriter<T>. Data is grouped into blocks. A synchronization marker is written between blocks, so that files may be split. Blocks may be compressed. Extensible metadata is stored at the end of the file. Files may be appended to.

Template Parameters
TType of datum to write to the file.
See also
IFileWriter<T>

Member Function Documentation

◆ Append()

void Avro.File.DataFileWriter< T >.Append ( datum)
inline

Append datum to a file or stream.

Parameters
datumDatum to append.

Implements Avro.File.IFileWriter< T >.

◆ Close()

void Avro.File.DataFileWriter< T >.Close ( )
inline

Closes the file or stream.

Implements Avro.File.IFileWriter< T >.

◆ Dispose()

virtual void Avro.File.DataFileWriter< T >.Dispose ( bool  disposing)
inlineprotectedvirtual

Releases resources associated with this DataFileWriter<T>.

Parameters
disposingTrue if called from Dispose(); false otherwise.

◆ Flush()

void Avro.File.DataFileWriter< T >.Flush ( )
inline

Flush out any buffered data.

Implements Avro.File.IFileWriter< T >.

◆ IsReservedMeta()

bool Avro.File.DataFileWriter< T >.IsReservedMeta ( string  key)
inline

Returns true if parameter is a reserved Avro metadata value.

Parameters
keyMetadata key.
Returns
True if parameter is a reserved Avro metadata value, false otherwise.

Implements Avro.File.IFileWriter< T >.

◆ OpenAppendWriter() [1/2]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenAppendWriter ( DatumWriter< T >  writer,
Stream  inStream,
Stream  outStream 
)
inlinestatic

Open a new writer instance to append to an output stream. Both in and out streams must point to the same file.

Parameters
writerDatum writer to use.
inStreamreading the existing file.
outStreamstream to write to, positioned at the end of the existing file.
Returns
A new file writer.
Exceptions
AvroRuntimeException{nameof(inStream)} must have Read access or {nameof(outStream)} must have Write access

◆ OpenAppendWriter() [2/2]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenAppendWriter ( DatumWriter< T >  writer,
string  path 
)
inlinestatic

Open a new writer instance to append to a file path.

Parameters
writerDatum writer to use.
pathPath to the file.
Returns
A new file writer.

◆ OpenWriter() [1/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
Stream  outStream 
)
inlinestatic

Open a new writer instance to write to an output stream, using a Null codec.

Parameters
writerDatum writer to use.
outStreamStream to write to.
Returns
A new file writer.

◆ OpenWriter() [2/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
Stream  outStream,
bool  leaveOpen 
)
inlinestatic

Open a new writer instance to write to an output stream, using a Null codec.

Parameters
writerDatum writer to use.
outStreamStream to write to.
leaveOpenLeave the stream open after disposing the object
Returns
A new file writer.

◆ OpenWriter() [3/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
Stream  outStream,
Codec  codec 
)
inlinestatic

Open a new writer instance to write to an output stream with a specified codec.

Parameters
writerDatum writer to use.
outStreamStream to write to.
codecCodec to use when writing.
Returns
A new file writer.

◆ OpenWriter() [4/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
Stream  outStream,
Codec  codec,
bool  leaveOpen 
)
inlinestatic

Open a new writer instance to write to an output stream with a specified codec.

Parameters
writerDatum writer to use.
outStreamStream to write to.
codecCodec to use when writing.
leaveOpenLeave the stream open after disposing the object
Returns
A new file writer.

◆ OpenWriter() [5/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
string  path 
)
inlinestatic

Open a new writer instance to write to a file path, using a Null codec.

Parameters
writerDatum writer to use.
pathPath to the file.
Returns
A new file writer.

◆ OpenWriter() [6/6]

static IFileWriter< T > Avro.File.DataFileWriter< T >.OpenWriter ( DatumWriter< T >  writer,
string  path,
Codec  codec 
)
inlinestatic

Open a new writer instance to write to a file path with a specified codec.

Parameters
writerDatum writer to use.
pathPath to the file.
codecCodec to use when writing.
Returns
A new file writer.

◆ SetMeta() [1/3]

void Avro.File.DataFileWriter< T >.SetMeta ( string  key,
byte[]  value 
)
inline

Set metadata pair.

Parameters
keyMetadata key.
valueMetadata value.

Implements Avro.File.IFileWriter< T >.

◆ SetMeta() [2/3]

void Avro.File.DataFileWriter< T >.SetMeta ( string  key,
long  value 
)
inline

Set metadata pair (long value).

Parameters
keyMetadata key.
valueMetadata value.

Implements Avro.File.IFileWriter< T >.

◆ SetMeta() [3/3]

void Avro.File.DataFileWriter< T >.SetMeta ( string  key,
string  value 
)
inline

Set metadata pair (string value).

Parameters
keyMetadata key.
valueMetadata value.

Implements Avro.File.IFileWriter< T >.

◆ SetSyncInterval()

void Avro.File.DataFileWriter< T >.SetSyncInterval ( int  syncInterval)
inline

Set the synchronization interval for this file or stream, in bytes. Valid values range from 32 to 2^30. Suggested values are between 2K and 2M.

Parameters
syncIntervalApproximate number of uncompressed bytes to write in each block.

Implements Avro.File.IFileWriter< T >.

◆ Sync()

long Avro.File.DataFileWriter< T >.Sync ( )
inline

Forces the end of the current block, emitting a synchronization marker.

Returns
Current position as a value that may be passed to IFileReader<T>.Seek(long).

Implements Avro.File.IFileWriter< T >.


The documentation for this class was generated from the following file: