Package org.apache.avro.mapred
Class SequenceFileReader<K,V>
java.lang.Object
org.apache.avro.mapred.SequenceFileReader<K,V>
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<Pair<K,,V>> Iterator<Pair<K,,V>> FileReader<Pair<K,V>>
A
FileReader for sequence files.-
Constructor Summary
ConstructorsConstructorDescriptionSequenceFileReader(File file) SequenceFileReader(URI uri, Configuration c) SequenceFileReader(SequenceFile.Reader reader, Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Return the schema for data in this file.booleanhasNext()iterator()next()Read the next datum from the file.booleanpastSync(long position) Return true if past the next synchronization point after a position.voidremove()voidsync(long position) Move to the next synchronization point after a position.longtell()Return the current position in the input.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
SequenceFileReader
- Throws:
IOException
-
SequenceFileReader
- Throws:
IOException
-
SequenceFileReader
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
remove
public void remove() -
iterator
-
getSchema
Description copied from interface:FileReaderReturn the schema for data in this file.- Specified by:
getSchemain interfaceFileReader<K>
-
hasNext
public boolean hasNext() -
next
-
next
Description copied from interface:FileReaderRead the next datum from the file.- Specified by:
nextin interfaceFileReader<K>- Parameters:
reuse- an instance to reuse.- Throws:
IOException
-
sync
Description copied from interface:FileReaderMove to the next synchronization point after a position. To process a range of file entires, call this with the starting position, then checkFileReader.pastSync(long)with the end point before each call toIterator.next().- Specified by:
syncin interfaceFileReader<K>- Throws:
IOException
-
pastSync
Description copied from interface:FileReaderReturn true if past the next synchronization point after a position.- Specified by:
pastSyncin interfaceFileReader<K>- Throws:
IOException
-
tell
Description copied from interface:FileReaderReturn the current position in the input.- Specified by:
tellin interfaceFileReader<K>- Throws:
IOException
-