public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D>
DataFileWriter
.DataFileWriter
DataFileStream.Header
Modifier | Constructor and Description |
---|---|
|
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 . |
Modifier and Type | Method and Description |
---|---|
protected void |
blockFinished() |
static <D> FileReader<D> |
openReader(File file,
DatumReader<D> reader)
Open a reader for a file.
|
static <D> FileReader<D> |
openReader(SeekableInput in,
DatumReader<D> reader)
Open a reader for a file.
|
static <D> DataFileReader<D> |
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.
|
close, getBlockCount, getHeader, getMeta, getMetaKeys, getMetaLong, getMetaString, getSchema, hasNext, iterator, next, next, nextBlock, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSchema, next
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
IOException
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
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.