T - Type of data can be read.P - Type of position object.public interface FileReader<T,P> extends Closeable, PositionReporter<P>
| Modifier and Type | Method and Description |
|---|---|
void |
initialize()
Initialize the file reader.
|
int |
read(Collection<? super T> events,
int maxEvents,
long timeout,
TimeUnit unit)
Reads as much data as possible until maxEvents.
|
int |
read(Collection<? super T> events,
int maxEvents,
long timeout,
TimeUnit unit,
ReadFilter readFilter)
Reads as much data as possible that passes the given filter until maxEvents.
|
getPositionvoid initialize()
throws IOException
IOException - If initialization failed.int read(Collection<? super T> events, int maxEvents, long timeout, TimeUnit unit) throws IOException, InterruptedException
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.int read(Collection<? super T> events, int maxEvents, long timeout, TimeUnit unit, ReadFilter readFilter) throws IOException, InterruptedException
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.Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.