|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avro.file.DataFileStream<D> org.apache.avro.file.DataFileReader<D>
public class DataFileReader<D>
Random access to files written with DataFileWriter
.
DataFileWriter
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.avro.file.DataFileStream |
---|
DataFileStream.Header |
Constructor Summary | |
---|---|
|
DataFileReader(File file,
DatumReader<D> reader)
Construct a reader for a file. |
|
DataFileReader(SeekableInput sin,
DatumReader<D> reader)
Construct a reader for a file. |
protected |
DataFileReader(SeekableInput sin,
DatumReader<D> reader,
DataFileStream.Header header)
Construct using a DataFileStream.Header . |
Method Summary | ||
---|---|---|
protected void |
blockFinished()
|
|
static
|
openReader(File file,
DatumReader<D> reader)
Open a reader for a file. |
|
static
|
openReader(SeekableInput in,
DatumReader<D> reader)
Open a reader for a file. |
|
static
|
openReader(SeekableInput in,
DatumReader<D> reader,
DataFileStream.Header header,
boolean sync)
Construct a reader for a file at the current position of the input, without reading the header. |
|
boolean |
pastSync(long position)
Return true if past the next synchronization point after a position. |
|
long |
previousSync()
Return the last synchronization point before our current position. |
|
void |
seek(long position)
Move to a specific, known synchronization point, one returned from DataFileWriter.sync() while writing. |
|
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 org.apache.avro.file.DataFileStream |
---|
close, getBlockCount, getHeader, getMeta, getMetaKeys, getMetaLong, getMetaString, getSchema, hasNext, iterator, next, next, nextBlock, remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.avro.file.FileReader |
---|
getSchema, next |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Methods inherited from interface java.io.Closeable |
---|
close |
Constructor Detail |
---|
public DataFileReader(File file, DatumReader<D> reader) throws IOException
IOException
public DataFileReader(SeekableInput sin, DatumReader<D> reader) throws IOException
IOException
protected DataFileReader(SeekableInput sin, DatumReader<D> reader, DataFileStream.Header header) throws IOException
DataFileStream.Header
. Does not call sync(long)
or seek(long)
.
IOException
Method Detail |
---|
public static <D> FileReader<D> openReader(File file, DatumReader<D> reader) throws IOException
IOException
public static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException
IOException
public static <D> DataFileReader<D> openReader(SeekableInput in, DatumReader<D> reader, DataFileStream.Header header, boolean sync) throws IOException
sync
- True to read forward to the next sync point after opening,
false to assume that the input is already at a valid sync
point.
IOException
public void seek(long position) throws IOException
DataFileWriter.sync()
while writing. If synchronization points were not
saved while writing a file, use sync(long)
instead.
IOException
public void sync(long position) throws IOException
pastSync(long)
with the end point before each call to DataFileStream.next()
.
sync
in interface FileReader<D>
IOException
protected void blockFinished() throws IOException
blockFinished
in class DataFileStream<D>
IOException
public long previousSync()
public boolean pastSync(long position) throws IOException
pastSync
in interface FileReader<D>
IOException
public long tell() throws IOException
FileReader
tell
in interface FileReader<D>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |