olg.csv.base.ods
Class ODSReader

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

public class ODSReader
extends AbstractSheetReader

ODS Reader based on ODFDOM API.


Nested Class Summary
static class ODSReader.ODSCellFormatter
          Define a default cell format strategy.
 
Field Summary
private  Formatter<org.odftoolkit.odfdom.doc.table.OdfTableCell> cellFormatter
          The cell formatter.
private  boolean closeInputStream
          Indicate if the stream must be closed on close invocation.
private  InputStream input
          the stream.
private static org.slf4j.Logger LOGGER
          The class logger.
private  org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument odfDocument
          the ODS Document read from the stream.
private  int rowCount
          the nb of rows in the sheet.
private  org.odftoolkit.odfdom.doc.table.OdfTable sheet
          The sheet on which read.
 
Fields inherited from class olg.csv.base.AbstractSheetReader
beginAtColumn, beginAtRow, endAtColumn, endAtRow, recordIndex, rowSize, sheetName, sheetNum, skipEmptyCell, withHeaders
 
Constructor Summary
ODSReader(File odsFile, ODSSettings settings)
           
ODSReader(InputStream input, ODSSettings settings)
           
 
Method Summary
 void close()
          Closes this stream and catch and logs IOException if necessary. if the parent stream is provided and passed to ODSReader constructor by user, user must close it (closes what you opens!)
protected  int defineRowSize()
          Returns the expected rows length of each line.
protected  void doOnInitSheet()
          Method called by AbstractSheetReader.initSheet() to allow concret SheetReader to do some stuff on its instanciation.
protected  int getRows()
          Get the row count of this sheet.
protected  Row setNext()
          Returns the next Row.
 
Methods inherited from class olg.csv.base.AbstractSheetReader
getSheetName, getSheetNum, hasNext, initSheet, isWithHeaders, next, padding, remove
 
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.


cellFormatter

private final Formatter<org.odftoolkit.odfdom.doc.table.OdfTableCell> cellFormatter
The cell formatter.


closeInputStream

private boolean closeInputStream
Indicate if the stream must be closed on close invocation.


input

private final InputStream input
the stream.


odfDocument

private org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument odfDocument
the ODS Document read from the stream.


sheet

private org.odftoolkit.odfdom.doc.table.OdfTable sheet
The sheet on which read.


rowCount

private int rowCount
the nb of rows in the sheet.

Constructor Detail

ODSReader

public ODSReader(File odsFile,
                 ODSSettings settings)
          throws IOException
Parameters:
odsFile - the ODS File to read.
settings - ods settings. If sheetname setting is defined try to find a sheet with this name otherwise try to read sheet at sheetNum position in sheets list. Must be not null and have a cell formatter.
Throws:
IOException - if an error occurs during opening file,i.e the specified sheet has been not found

ODSReader

public ODSReader(InputStream input,
                 ODSSettings settings)
          throws IOException
Parameters:
input - the stream to read.
settings - ods settings. If sheetname setting is defined try to find a sheet with this name otherwise try to read sheet at sheetNum position in sheets list. Must be not null and have a cell formatter.
Throws:
IOException - if an error occurs during opening file,i.e the specified sheet has been not found
Method Detail

doOnInitSheet

protected void doOnInitSheet()
                      throws IOException
Description copied from class: AbstractSheetReader
Method called by AbstractSheetReader.initSheet() to allow concret SheetReader to do some stuff on its instanciation.

Specified by:
doOnInitSheet in class AbstractSheetReader
Throws:
IOException - if I/O error occurs.

close

public void close()
Closes this stream and catch and logs IOException if necessary. if the parent stream is provided and passed to ODSReader constructor by user, user must close it (closes what you opens!)

Specified by:
close in interface Closeable
Specified by:
close in class AbstractSheetReader

setNext

protected Row setNext()
Description copied from class: AbstractSheetReader
Returns the next Row.

Specified by:
setNext in class AbstractSheetReader
Returns:
the next row.

getRows

protected int getRows()
Description copied from class: AbstractSheetReader
Get the row count of this sheet.

Specified by:
getRows in class AbstractSheetReader
Returns:
total count of rows

defineRowSize

protected int defineRowSize()
Description copied from class: AbstractSheetReader
Returns the expected rows length of each line.

Specified by:
defineRowSize in class AbstractSheetReader
Returns:
the rows size.


Copyright © 2014. All Rights Reserved.