htsjdk.tribble.readers.LineIteratorImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of htsjdk Show documentation
Show all versions of htsjdk Show documentation
A Java API for high-throughput sequencing data (HTS) formats
package htsjdk.tribble.readers;
import htsjdk.samtools.util.AbstractIterator;
import htsjdk.samtools.util.CloserUtil;
import htsjdk.samtools.util.RuntimeIOException;
import java.io.Closeable;
import java.io.IOException;
/** A simple iterator over the elements in LineReader. */
public class LineIteratorImpl extends AbstractIterator implements LineIterator, Closeable {
private final LineReader lineReader;
/**
* @param lineReader The line reader whose elements are to be iterated over.
*/
public LineIteratorImpl(final LineReader lineReader) {
this.lineReader = lineReader;
}
@Override
protected String advance() {
try {
return lineReader.readLine();
} catch (IOException e) {
throw new RuntimeIOException(e);
}
}
@Override
public void close() throws IOException {
CloserUtil.close(lineReader);
}
@Override
public String toString() {
return "LineIteratorImpl(" + this.lineReader+")";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy