A stream-oriented dataset reader.
Subsystem-specific implementations of this interface are used to read data from a {@link Dataset}. Readers are use-once objects that produce entities of type {@code E}. Normally, users are not expected to instantiate implementations directly. Instead, use the containing dataset's {@link Dataset#getReader()} method to get an appropriate implementation.Normally, users receive an instance of this interface from a dataset, call {@link #open()} to prepare for IO operations, invoke {@link #hasNext()} and{@link #next()} as necessary, and {@link #close()} when they are done or nomore data exists.
Implementations may hold system resources until the {@link #close()} methodis called, so users must follow the normal try / finally pattern to ensure these resources are properly freed when the reader is exhausted or no longer useful. Do not rely on implementations automatically invoking the {@code close()} method upon object finalization (althoughimplementations are free to do so, if they choose). All implementations must silently ignore multiple invocations of {@code close()} as well as a close ofan unopened reader.
If any method throws an exception, the reader is no longer valid, and the only method that may be subsequently called is {@code close()}.
Implementations of {@link DatasetReader} are typically not thread-safe; that is,the behavior when accessing a single instance from multiple threads is undefined.
@param < E> The type of entity produced by this reader.
|
|