@NotThreadSafe public final class MultiLiveStreamFileReader extends Object implements FileReader<StreamEventOffset,Iterable<StreamFileOffset>>
FileReader that combines multiple event stream into single event stream.| Constructor and Description |
|---|
MultiLiveStreamFileReader(StreamConfig streamConfig,
Iterable<? extends StreamFileOffset> offsets) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Iterable<StreamFileOffset> |
getPosition()
Returns the position information.
|
void |
initialize()
Initialize the file reader.
|
int |
read(Collection<? super StreamEventOffset> events,
int maxEvents,
long timeout,
TimeUnit unit)
Reads as much data as possible until maxEvents.
|
int |
read(Collection<? super StreamEventOffset> events,
int maxEvents,
long timeout,
TimeUnit unit,
ReadFilter readFilter)
Reads as much data as possible that passes the given filter until maxEvents.
|
public MultiLiveStreamFileReader(StreamConfig streamConfig, Iterable<? extends StreamFileOffset> offsets)
public void initialize()
throws IOException
FileReaderinitialize in interface FileReader<StreamEventOffset,Iterable<StreamFileOffset>>IOException - If initialization failed.public int read(Collection<? super StreamEventOffset> events, int maxEvents, long timeout, TimeUnit unit) throws IOException, InterruptedException
FileReaderread in interface FileReader<StreamEventOffset,Iterable<StreamFileOffset>>events - Collection for storing data read.maxEvents - Maximum number of events to read.timeout - Maximum of time to spend on trying to read eventsunit - Unit for the timeout.0. If -1 is returned, meaning it reached EOF and all
sub-sequence call to this method will also return -1.IOException - If failed to read.InterruptedException - If the reading is interrupted.public int read(Collection<? super StreamEventOffset> events, int maxEvents, long timeout, TimeUnit unit, ReadFilter readFilter) throws IOException, InterruptedException
FileReaderread in interface FileReader<StreamEventOffset,Iterable<StreamFileOffset>>events - Collection for storing data read.maxEvents - Maximum number of events to read.timeout - Maximum of time to spend on trying to read eventsunit - Unit for the timeout.readFilter - Filter to apply during reading0. If -1 is returned, meaning it reached EOF and all
sub-sequence call to this method will also return -1.IOException - If failed to read.InterruptedException - If the reading is interrupted.public Iterable<StreamFileOffset> getPosition()
PositionReportergetPosition in interface PositionReporter<Iterable<StreamFileOffset>><P>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.