org.knime.base.node.io.filereader
Class FileReaderPreviewRowIterator

java.lang.Object
  extended by org.knime.core.data.RowIterator
      extended by org.knime.base.node.io.filereader.FileReaderPreviewRowIterator
All Implemented Interfaces:
Iterator<DataRow>

 class FileReaderPreviewRowIterator
extends RowIterator

The iterator for the FileReaderPreviewTable. Wraps the iterator of the underlying file table. Catches exceptions thrown by the underlying iterator, returns an "error row" instead and will end the table. If an error occurres it sets an error message in the underlying table.

Author:
Peter, University of Konstanz

Constructor Summary
FileReaderPreviewRowIterator(FileRowIterator rowIterator, FileReaderPreviewTable previewTable)
          A new non-failing file row iterator.
 
Method Summary
 void dispose()
          Call this before releasing the last reference to this iterator.
protected  void finalize()
          
 boolean hasNext()
          Returns true if there are more rows and false otherwise.
 DataRow next()
          Returns the next DataRow.
 
Methods inherited from class org.knime.core.data.RowIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileReaderPreviewRowIterator

FileReaderPreviewRowIterator(FileRowIterator rowIterator,
                             FileReaderPreviewTable previewTable)
A new non-failing file row iterator. It wraps the passed iterator and catches its exceptions, converting them into rows with error messages.

Parameters:
rowIterator - the row iterator to wrap
previewTable - the corresponding table this is the iterator from. Needed to pull the sprc from for creating the row in case of an error/exception and to tell the table an error occurred.
Method Detail

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

dispose

public void dispose()
Call this before releasing the last reference to this iterator. It closes the underlying source. Especially if the iterator didn't run to the end of the table, it is required to call this method. Otherwise the file handle is not released until the garbage collector cleans up. A call to next() after disposing of the iterator has undefined behavior.


hasNext

public boolean hasNext()
Returns true if there are more rows and false otherwise.

Specified by:
hasNext in interface Iterator<DataRow>
Specified by:
hasNext in class RowIterator
Returns:
true if the iterator has more elements, otherwise false
See Also:
RowIterator.next()

next

public DataRow next()
Returns the next DataRow.

Specified by:
next in interface Iterator<DataRow>
Specified by:
next in class RowIterator
Returns:
the next row in the DataTable


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.