Package org.apache.avro.file
Interface FileReader<D>
- All Superinterfaces:
AutoCloseable
,Closeable
,Iterable<D>
,Iterator<D>
- All Known Implementing Classes:
DataFileReader
,DataFileReader12
,SequenceFileReader
Interface for reading data from a file.
-
Method Summary
Modifier and TypeMethodDescriptionReturn the schema for data in this file.Read the next datum from the file.boolean
pastSync
(long position) Return true if past the next synchronization point after a position.void
sync
(long position) Move to the next synchronization point after a position.long
tell()
Return the current position in the input.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
getSchema
Schema getSchema()Return the schema for data in this file. -
next
Read the next datum from the file.- Parameters:
reuse
- an instance to reuse.- Throws:
NoSuchElementException
- if no more remain in the file.IOException
-
sync
Move to the next synchronization point after a position. To process a range of file entires, call this with the starting position, then checkpastSync(long)
with the end point before each call toIterator.next()
.- Throws:
IOException
-
pastSync
Return true if past the next synchronization point after a position.- Throws:
IOException
-
tell
Return the current position in the input.- Throws:
IOException
-