olg.csv.base
Class IgnoreNullReader

Package class diagram package IgnoreNullReader
java.lang.Object
  extended by olg.csv.base.IgnoreNullReader
All Implemented Interfaces:
Closeable, Iterator<Row>, IReader

public class IgnoreNullReader
extends Object
implements IReader

A "Proxy" reader which Provides a mecanism to skip empty row.


Field Summary
private  Row currentRow
          the last row retrieved from the original reader.
private  ReaderException exception
          because next() method even if returns the next element, loads the following row.
private static org.slf4j.Logger LOGGER
          The class logger.
private  boolean next
           
private  IReader reader
          the original reader.
 
Constructor Summary
IgnoreNullReader(IReader reader)
           
 
Method Summary
 void close()
          close the original reader.
 boolean hasNext()
           
 boolean isWithHeaders()
          Indicates if the file has a headers line.
 Row next()
           
 void remove()
          Throws UnsupportedOperationException.
private  Row setNext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The class logger.


reader

private final IReader reader
the original reader.


currentRow

private Row currentRow
the last row retrieved from the original reader.


next

private boolean next

exception

private ReaderException exception
because next() method even if returns the next element, loads the following row. During loading the following row a readException could occur. So we need to keep this exception to throw it on the following call of next() method.

Constructor Detail

IgnoreNullReader

public IgnoreNullReader(IReader reader)
Parameters:
reader - a concret reader
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Row>
Returns:
true if exists a next not empty row.

next

public Row next()
Specified by:
next in interface Iterator<Row>
Returns:
the next not empty row.

setNext

private Row setNext()
Returns:
the next not empty row.

remove

public void remove()
Throws UnsupportedOperationException.

Specified by:
remove in interface Iterator<Row>

close

public void close()
close the original reader.

Specified by:
close in interface Closeable

isWithHeaders

public boolean isWithHeaders()
Description copied from interface: IReader
Indicates if the file has a headers line.

Specified by:
isWithHeaders in interface IReader
Returns:
the original withHeaders attribute.


Copyright © 2014. All Rights Reserved.