Hi,

I'd like to keep track of the number of bytes read as I'm reading through
the records of an Avro file.

See this sample code:

File file = new File("mydata.avro");
DatumReader<GenericRecord> reader = new GenericDatumReader<>();
DataFileReader<GenericRecord> fileReader = new DataFileReader<>(file,
reader);
GenericRecord record = new GenericData.Record(fileReader.getSchema());
long counter = 0;
while (fileReader.hasNext()) {
    fileReader.next(record);
    *counter += // Magic happens here*
    System.out.println("Bytes read so far: " + counter);
}

I can't seem to find a way to extract that information from the `fileReader`
or  `record` objects. I figured maybe `fileReader.tell()` might help here,
but that value seems to stay stuck on the current block's position.

Is this possible?

Thanks!

Julien

Reply via email to