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
ConstructorDescriptionSequenceFileReader
(File file) SequenceFileReader
(URI uri, Configuration c) SequenceFileReader
(SequenceFile.Reader reader, Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Return the schema for data in this file.boolean
hasNext()
iterator()
next()
Read the next datum from the file.boolean
pastSync
(long position) Return true if past the next synchronization point after a position.void
remove()
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
SequenceFileReader
- Throws:
IOException
-
SequenceFileReader
- Throws:
IOException
-
SequenceFileReader
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
remove
public void remove() -
iterator
-
getSchema
Description copied from interface:FileReader
Return the schema for data in this file.- Specified by:
getSchema
in interfaceFileReader<K>
-
hasNext
public boolean hasNext() -
next
-
next
Description copied from interface:FileReader
Read the next datum from the file.- Specified by:
next
in interfaceFileReader<K>
- Parameters:
reuse
- an instance to reuse.- Throws:
IOException
-
sync
Description copied from interface:FileReader
Move 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:
sync
in interfaceFileReader<K>
- Throws:
IOException
-
pastSync
Description copied from interface:FileReader
Return true if past the next synchronization point after a position.- Specified by:
pastSync
in interfaceFileReader<K>
- Throws:
IOException
-
tell
Description copied from interface:FileReader
Return the current position in the input.- Specified by:
tell
in interfaceFileReader<K>
- Throws:
IOException
-