use of org.knime.core.data.container.storage.AbstractTableStoreReader.TableStoreCloseableRowIterator in project knime-core by knime.
the class Buffer method iterator.
/**
* Get a new <code>RowIterator</code>, traversing all rows that have been added. Calling this method makes only
* sense when the buffer has been closed. However, no check is done (as it is available to package classes only).
*
* @return a new Iterator over all rows.
*/
synchronized CloseableRowIterator iterator() {
if (usesOutFile()) {
if (m_useBackIntoMemoryIterator) {
// the order of the following lines is very important!
m_useBackIntoMemoryIterator = false;
m_backIntoMemoryIterator = iterator();
// we never store more than 2^31 rows in memory, therefore it's safe to cast to int
m_list = new ArrayList<BlobSupportDataRow>((int) size());
return new FromListIterator();
}
try {
LOGGER.debug("Opening input stream on file \"" + m_binFile.getAbsolutePath() + "\", " + m_nrOpenInputStreams + " open streams");
TableStoreCloseableRowIterator iterator = m_outputReader.iterator();
iterator.setBuffer(this);
m_nrOpenInputStreams.incrementAndGet();
synchronized (m_openIteratorSet) {
m_openIteratorSet.put(iterator, DUMMY);
}
return iterator;
} catch (IOException ioe) {
StringBuilder b = new StringBuilder("Cannot read file \"");
b.append(m_binFile != null ? m_binFile.getName() : "<unknown>");
b.append("\"");
checkAndReportOpenFiles(ioe);
throw new RuntimeException(b.toString(), ioe);
}
} else {
return new FromListIterator();
}
}
Aggregations