Avro C#
Loading...
Searching...
No Matches
Avro.File.DataFileReader< T > Class Template Reference

Provides access to Avro data written using the DataFileWriter<T>. More...

Inheritance diagram for Avro.File.DataFileReader< T >:
Avro.File.IFileReader< T >

Public Member Functions

delegate DatumReader< T > CreateDatumReader (Schema writerSchema, Schema readerSchema)
 Defines the signature for a function that returns a new DatumReader<T> given a writer and reader schema.
Header GetHeader ()
 Return the header for the input file or stream.
Returns
Parsed header from the file or stream.

Schema GetSchema ()
 Return the schema as read from the file or stream.
Returns
Parse schema from the file or stream.

ICollection< string > GetMetaKeys ()
 Return the list of keys in the metadata.
Returns
Metadata keys from the header of the data file.

byte[] GetMeta (string key)
 Return the byte value of a metadata property.
Parameters
keyKey for the metadata entry.
Returns
Raw bytes of the value of the metadata entry.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .

long GetMetaLong (string key)
 Return the long value of a metadata property.
Parameters
keyKey for the metadata entry.
Returns
Metadata value as a long.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .

string GetMetaString (string key)
 Return the string value of a metadata property. This method assumes that the string is a UTF-8 encoded in the header.
Parameters
keyKey for the metadata entry.
Returns
Metadata value as a string.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .
AvroRuntimeExceptionEncountered an exception while decoding the value as a UTF-8 string.

void Seek (long position)
 Move to a specific, known synchronization point, one returned from IFileWriter<T>.Sync while writing.
Parameters
positionPosition to jump to.

void Sync (long position)
 Move to the next synchronization point after a position.
Parameters
positionPosition in the stream to start.

bool PastSync (long position)
 Return true if past the next synchronization point after a position.
Parameters
positionPosition to test.
Returns
True if path the next synchronization point after position , false otherwise.

long PreviousSync ()
 Return the last synchronization point before our current position.
Returns
Position of the last synchronization point before our current position.

long Tell ()
 Return the current position in the input.
Returns
Current position in the input.

bool HasNext ()
 Returns true if more entries remain in this file.
Returns
True if more entries remain in this file, false otherwise.

void Reset ()
 Resets this reader.
void Dispose ()
T Next ()
 Read the next datum from the file.
Returns
Next deserialized data entry.

 DataBlock (long numberOfEntries, long blockSize)
 Initializes a new instance of the DataBlock class.

Static Public Member Functions

static IFileReader< T > OpenReader (string path)
 Open a reader for a file using path.
static IFileReader< T > OpenReader (string path, Schema readerSchema)
 Open a reader for a file using path and the reader's schema.
static IFileReader< T > OpenReader (Stream inStream)
 Open a reader for a stream.
static IFileReader< T > OpenReader (Stream inStream, bool leaveOpen)
 Open a reader for a stream.
static IFileReader< T > OpenReader (Stream inStream, Schema readerSchema)
 Open a reader for a stream using the reader's schema.
static IFileReader< T > OpenReader (Stream inStream, Schema readerSchema, bool leaveOpen)
 Open a reader for a stream using the reader's schema.
static IFileReader< T > OpenReader (Stream inStream, Schema readerSchema, CreateDatumReader datumReaderFactory)
 Open a reader for a stream using the reader's schema and a custom DatumReader.
static IFileReader< T > OpenReader (Stream inStream, Schema readerSchema, CreateDatumReader datumReaderFactory, bool leaveOpen)
 Open a reader for a stream using the reader's schema and a custom DatumReader.

Protected Member Functions

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

Properties

IEnumerable< T > NextEntries [get]
 Return an enumeration of the remaining entries in the file.
Returns
An enumeration of the remaining entries in the file.

byte[] Data [get, set]
 Gets or sets raw bytes within this block.
long NumberOfEntries [get, set]
 Gets or sets number of entries in this block.
long BlockSize [get, set]
 Gets or sets size of this block in bytes.

Detailed Description

Provides access to Avro data written using the DataFileWriter<T>.

Template Parameters
TType to deserialze data objects to.
See also
IFileReader<T>

Member Function Documentation

◆ CreateDatumReader()

delegate DatumReader< T > Avro.File.DataFileReader< T >.CreateDatumReader ( Schema writerSchema,
Schema readerSchema )

Defines the signature for a function that returns a new DatumReader<T> given a writer and reader schema.

Parameters
writerSchemaSchema used to write the datum.
readerSchemaSchema used to read the datum.
Returns
A datum reader.

◆ DataBlock()

Avro.File.DataFileReader< T >.DataBlock ( long numberOfEntries,
long blockSize )
inline

Initializes a new instance of the DataBlock class.

Parameters
numberOfEntriesNumber of entries in this block.
blockSizeSize of this block in bytes.

◆ Dispose()

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

Releases resources associated with this DataFileReader<T>.

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

◆ GetHeader()

Header Avro.File.DataFileReader< T >.GetHeader ( )
inline

Return the header for the input file or stream.

Returns
Parsed header from the file or stream.

Implements Avro.File.IFileReader< T >.

◆ GetMeta()

byte[] Avro.File.DataFileReader< T >.GetMeta ( string key)
inline

Return the byte value of a metadata property.

Parameters
keyKey for the metadata entry.
Returns
Raw bytes of the value of the metadata entry.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .

Implements Avro.File.IFileReader< T >.

◆ GetMetaKeys()

ICollection< string > Avro.File.DataFileReader< T >.GetMetaKeys ( )
inline

Return the list of keys in the metadata.

Returns
Metadata keys from the header of the data file.

Implements Avro.File.IFileReader< T >.

◆ GetMetaLong()

long Avro.File.DataFileReader< T >.GetMetaLong ( string key)
inline

Return the long value of a metadata property.

Parameters
keyKey for the metadata entry.
Returns
Metadata value as a long.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .

Implements Avro.File.IFileReader< T >.

◆ GetMetaString()

string Avro.File.DataFileReader< T >.GetMetaString ( string key)
inline

Return the string value of a metadata property. This method assumes that the string is a UTF-8 encoded in the header.

Parameters
keyKey for the metadata entry.
Returns
Metadata value as a string.
Exceptions
KeyNotFoundExceptionThere is no metadata entry with the specified key .
AvroRuntimeExceptionEncountered an exception while decoding the value as a UTF-8 string.

Implements Avro.File.IFileReader< T >.

◆ GetSchema()

Schema Avro.File.DataFileReader< T >.GetSchema ( )
inline

Return the schema as read from the file or stream.

Returns
Parse schema from the file or stream.

Implements Avro.File.IFileReader< T >.

◆ HasNext()

bool Avro.File.DataFileReader< T >.HasNext ( )
inline

Returns true if more entries remain in this file.

Returns
True if more entries remain in this file, false otherwise.

Implements Avro.File.IFileReader< T >.

◆ Next()

T Avro.File.DataFileReader< T >.Next ( )
inline

Read the next datum from the file.

Returns
Next deserialized data entry.

Implements Avro.File.IFileReader< T >.

◆ OpenReader() [1/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream)
inlinestatic

Open a reader for a stream.

Parameters
inStreamThe in stream.
Returns
File Reader.

◆ OpenReader() [2/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream,
bool leaveOpen )
inlinestatic

Open a reader for a stream.

Parameters
inStreamThe in stream.
leaveOpenLeave the stream open after disposing the object.
Returns
File Reader.

◆ OpenReader() [3/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream,
Schema readerSchema )
inlinestatic

Open a reader for a stream using the reader's schema.

Parameters
inStreamStream containing the file contents.
readerSchemaSchema used to read the file.
Returns
A new file reader.

◆ OpenReader() [4/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream,
Schema readerSchema,
bool leaveOpen )
inlinestatic

Open a reader for a stream using the reader's schema.

Parameters
inStreamStream containing the file contents.
readerSchemaSchema used to read the file.
leaveOpenLeave the stream open after disposing the object.
Returns
A new file reader.

◆ OpenReader() [5/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream,
Schema readerSchema,
CreateDatumReader datumReaderFactory )
inlinestatic

Open a reader for a stream using the reader's schema and a custom DatumReader.

Parameters
inStreamStream of file contents.
readerSchemaSchema used to read the file.
datumReaderFactoryFactory to create datum readers given a reader an writer schema.
Returns
A new file reader.

◆ OpenReader() [6/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( Stream inStream,
Schema readerSchema,
CreateDatumReader datumReaderFactory,
bool leaveOpen )
inlinestatic

Open a reader for a stream using the reader's schema and a custom DatumReader.

Parameters
inStreamStream of file contents.
readerSchemaSchema used to read the file.
datumReaderFactoryFactory to create datum readers given a reader an writer schema.
leaveOpenLeave the stream open after disposing the object.
Returns
A new file reader.

◆ OpenReader() [7/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( string path)
inlinestatic

Open a reader for a file using path.

Parameters
pathThe path.
Returns
File Reader.

◆ OpenReader() [8/8]

IFileReader< T > Avro.File.DataFileReader< T >.OpenReader ( string path,
Schema readerSchema )
inlinestatic

Open a reader for a file using path and the reader's schema.

Parameters
pathPath to the file.
readerSchemaSchema used to read data from the file.
Returns
A new file reader.

◆ PastSync()

bool Avro.File.DataFileReader< T >.PastSync ( long position)
inline

Return true if past the next synchronization point after a position.

Parameters
positionPosition to test.
Returns
True if path the next synchronization point after position , false otherwise.

Implements Avro.File.IFileReader< T >.

◆ PreviousSync()

long Avro.File.DataFileReader< T >.PreviousSync ( )
inline

Return the last synchronization point before our current position.

Returns
Position of the last synchronization point before our current position.

Implements Avro.File.IFileReader< T >.

◆ Seek()

void Avro.File.DataFileReader< T >.Seek ( long position)
inline

Move to a specific, known synchronization point, one returned from IFileWriter<T>.Sync while writing.

Parameters
positionPosition to jump to.

Implements Avro.File.IFileReader< T >.

◆ Sync()

void Avro.File.DataFileReader< T >.Sync ( long position)
inline

Move to the next synchronization point after a position.

Parameters
positionPosition in the stream to start.

Implements Avro.File.IFileReader< T >.

◆ Tell()

long Avro.File.DataFileReader< T >.Tell ( )
inline

Return the current position in the input.

Returns
Current position in the input.

Implements Avro.File.IFileReader< T >.

Property Documentation

◆ BlockSize

long Avro.File.DataFileReader< T >.BlockSize
getset

Gets or sets size of this block in bytes.

The size of the block.

◆ Data

byte [] Avro.File.DataFileReader< T >.Data
getset

Gets or sets raw bytes within this block.

The data.

◆ NextEntries

IEnumerable<T> Avro.File.DataFileReader< T >.NextEntries
get

Return an enumeration of the remaining entries in the file.

Returns
An enumeration of the remaining entries in the file.

Implements Avro.File.IFileReader< T >.

◆ NumberOfEntries

long Avro.File.DataFileReader< T >.NumberOfEntries
getset

Gets or sets number of entries in this block.

The number of entries.


The documentation for this class was generated from the following file:
  • src/apache/main/File/DataFileReader.cs