public interface RecordReader
extends java.io.Closeable
Modifier and Type | Method and Description |
---|---|
int |
getBlockIndex()
Returns the block index that the Reader is currently reading from.
|
long |
getBytesConsumed() |
long |
getMaxEventId()
Returns the ID of the last event in this record reader, or -1 if the reader has no records or
has already read through all records.
|
TocReader |
getTocReader()
Returns the
TocReader that is used to keep track of compression blocks, if one exists,
null otherwise |
boolean |
isBlockIndexAvailable()
Returns
true if the compression block index is available. |
boolean |
isData()
Returns
true if there is more data for hte Record Reader to read, false otherwise. |
StandardProvenanceEventRecord |
nextRecord()
Returns the next record in the reader, or
null if there is no more data available. |
void |
skip(long bytesToSkip)
Skips the specified number of bytes
|
void |
skipTo(long position)
Skips to the specified byte offset in the underlying stream.
|
void |
skipToBlock(int blockIndex)
Skips to the specified compression block
|
java.util.Optional<ProvenanceEventRecord> |
skipToEvent(long eventId)
Skips to the first event in the stream with an Event ID >= the given ID.
|
StandardProvenanceEventRecord nextRecord() throws java.io.IOException
null
if there is no more data available.java.io.IOException
- if unable to read the next event from the streamvoid skip(long bytesToSkip) throws java.io.IOException
bytesToSkip
- the number of bytes to skip aheadjava.io.IOException
- if unable to skip ahead the specified number of bytes (e.g., the stream does
not contain this many more bytes)void skipTo(long position) throws java.io.IOException
position
- the byte offset to skip tojava.io.IOException
- if the underlying stream throws IOException, or if the reader has already
passed the specified byte offsetvoid skipToBlock(int blockIndex) throws java.io.IOException
blockIndex
- the block index to skip tojava.io.IOException
- if the underlying stream throws IOException, or if the reader has already
read passed the specified compression block indexjava.lang.IllegalStateException
- if the RecordReader does not have a TableOfContents associated with itjava.util.Optional<ProvenanceEventRecord> skipToEvent(long eventId) throws java.io.IOException
nextRecord()
, this method does not consume the returned event from the stream.
I.e., if a record is returned, that same record will be returned again the next time that nextRecord()
is called.eventId
- the ID of the event to retrievejava.io.IOException
- if the underlying stream throws IOExceptionint getBlockIndex()
nextRecord()
method. This means that this method will return the block from which the previous record was read,
if calling nextRecord()
continually, not the block from which the next record will be read.java.lang.IllegalStateException
- if the reader is reading a provenance event file that does not contain
a Table of Contentsboolean isBlockIndexAvailable()
true
if the compression block index is available. It will be available
if and only if the reader is created with a TableOfContentsTocReader getTocReader()
TocReader
that is used to keep track of compression blocks, if one exists,
null
otherwisenull
otherwise.long getBytesConsumed()
long getMaxEventId() throws java.io.IOException
java.io.IOException
- if unable to get id of the last eventboolean isData()
true
if there is more data for hte Record Reader to read, false
otherwise.true
if there is more data for hte Record Reader to read, false
otherwise.