Class ReaderLineIterable
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterable<String>,- MappableIterable<String>
It has been designed for a single use in a for statement. A second use will of the same Object will cause an Exception.
Any Exception thrown by the Reader during iteration are intercepted and not throw.
 The Iterator will automatically close the underlying reader when
 Iterator.hasNext() returns false, which includes when it leaves a for
 loop. Any Exception thrown by the Reader during this close are intercepted
 and not throw.
 
 It is recommended to always specifically call the Iterable's close method
 after finishing with the Iteration. It makes sure the underlying reader has
 been closed. It also raises the first Exception that may have been trapped
 during an early Iterator.next() or Iterator.hasNext()
 including during the reader closed done then. The recommended way to make
 sure close is called is with a try-with-resources statement.
- Author:
- Donal Fellows, Christian
- 
Constructor SummaryConstructorsConstructorDescriptionReaderLineIterable(InputStream inputStream) Create a new one-shot iterable.ReaderLineIterable(Reader reader) Create a new one-shot iterable.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface uk.ac.manchester.spinnaker.utils.MappableIterablefilter, first, first, map, nth, toCollectingMap, toCollectingMap, toCollectingMap, toCollectingMap, toList, toList, toMap, toMap, toSet, toSet
- 
Constructor Details- 
ReaderLineIterableCreate a new one-shot iterable.- Parameters:
- inputStream- The input stream to read from, using UTF-8 as the encoding.
 
- 
ReaderLineIterableCreate a new one-shot iterable.- Parameters:
- reader- The reader to read from.
 
 
- 
- 
Method Details- 
iterator
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-