public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D>
DataFileWriter.DataFileWriterDataFileStream.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,
              boolean closeOnError)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, getBlockSize, getHeader, getMeta, getMetaKeys, getMetaLong, getMetaString, getSchema, hasNext, iterator, next, next, nextBlock, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSchema, nextforEachRemaining, hasNext, next, removeforEach, iterator, spliteratorpublic DataFileReader(File file, DatumReader<D> reader) throws IOException
try (FileReaderdataFileReader = DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch (IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for file: %s", file); } 
IOExceptionpublic DataFileReader(SeekableInput sin, DatumReader<D> reader) throws IOException
try (FileReaderdataFileReader = DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch (IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for file: %s", file); } 
IOExceptionprotected DataFileReader(SeekableInput sin, DatumReader<D> reader, boolean closeOnError) throws IOException
IOExceptionprotected DataFileReader(SeekableInput sin, DatumReader<D> reader, DataFileStream.Header header) throws IOException
IOExceptionpublic static <D> FileReader<D> openReader(File file, DatumReader<D> reader) throws IOException
IOExceptionpublic static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException
IOExceptionpublic 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.IOExceptionpublic void seek(long position)
          throws IOException
DataFileWriter.sync() while writing. If synchronization points were
 not saved while writing a file, use sync(long) instead.IOExceptionpublic void sync(long position)
          throws IOException
pastSync(long) with the end point before each call to
 DataFileStream.next().sync in interface FileReader<D>IOExceptionprotected void blockFinished()
                      throws IOException
blockFinished in class DataFileStream<D>IOExceptionpublic long previousSync()
public boolean pastSync(long position)
                 throws IOException
pastSync in interface FileReader<D>IOExceptionpublic long tell()
          throws IOException
FileReadertell in interface FileReader<D>IOExceptionCopyright © 2009–2020 The Apache Software Foundation. All rights reserved.