adams.data.io.input
Class AbstractMultiSheetSpreadSheetReader

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.io.input.AbstractSpreadSheetReader
              extended by adams.data.io.input.AbstractMultiSheetSpreadSheetReader
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, Stoppable, MultiSheetSpreadSheetReader, SpreadSheetReader, Serializable
Direct Known Subclasses:
AbstractMultiSheetSpreadSheetReaderWithMissingValueSupport

public abstract class AbstractMultiSheetSpreadSheetReader
extends AbstractSpreadSheetReader
implements MultiSheetSpreadSheetReader

Ancestor for spreadsheet readers that can read multiple sheets from a document in one go.

Version:
$Revision: 7023 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class adams.data.io.input.AbstractSpreadSheetReader
AbstractSpreadSheetReader.InputType
 
Field Summary
protected  Range m_SheetRange
          the range of sheets to load.
 
Fields inherited from class adams.data.io.input.AbstractSpreadSheetReader
m_DataRowType, m_Stopped
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractMultiSheetSpreadSheetReader()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  SpreadSheet doRead(File file)
          Performs the actual reading.
protected  SpreadSheet doRead(InputStream in)
          Performs the actual reading.
protected  SpreadSheet doRead(Reader r)
          Performs the actual reading.
protected  List<SpreadSheet> doReadRange(File file)
          Performs the actual reading.
protected  List<SpreadSheet> doReadRange(InputStream in)
          Performs the actual reading.
protected  List<SpreadSheet> doReadRange(Reader r)
          Performs the actual reading.
 Range getSheetRange()
          Returns the range of the sheets to load.
 List<SpreadSheet> readRange(File file)
          Reads the spreadsheet from the specified file.
 List<SpreadSheet> readRange(InputStream stream)
          Reads the spreadsheets from the stream.
 List<SpreadSheet> readRange(Reader r)
          Reads the spreadsheets from the given reader.
 List<SpreadSheet> readRange(String filename)
          Reads the spreadsheets from the given file.
 void setSheetRange(Range value)
          Sets the range of the sheets to load.
 String sheetRangeTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.io.input.AbstractSpreadSheetReader
check, dataRowTypeTipText, getDataRowType, getDefaultDataRowType, getFormatDescription, getFormatExtensions, getInputType, getReaders, isStopped, read, read, read, read, setDataRowType, stopExecution
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, globalInfo, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface adams.data.io.input.SpreadSheetReader
dataRowTypeTipText, getDataRowType, getFormatDescription, getFormatExtensions, isStopped, read, read, read, read, setDataRowType, stopExecution
 
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
 
Methods inherited from interface adams.core.Destroyable
destroy
 

Field Detail

m_SheetRange

protected Range m_SheetRange
the range of sheets to load.

Constructor Detail

AbstractMultiSheetSpreadSheetReader

public AbstractMultiSheetSpreadSheetReader()
Method Detail

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractSpreadSheetReader

setSheetRange

public void setSheetRange(Range value)
Sets the range of the sheets to load.

Specified by:
setSheetRange in interface MultiSheetSpreadSheetReader
Parameters:
value - the range (1-based)

getSheetRange

public Range getSheetRange()
Returns the range of the sheets to load.

Specified by:
getSheetRange in interface MultiSheetSpreadSheetReader
Returns:
the range (1-based)

sheetRangeTipText

public String sheetRangeTipText()
Returns the tip text for this property.

Specified by:
sheetRangeTipText in interface MultiSheetSpreadSheetReader
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

readRange

public List<SpreadSheet> readRange(File file)
Reads the spreadsheet from the specified file.

Specified by:
readRange in interface MultiSheetSpreadSheetReader
Parameters:
file - the file to read from
Returns:
null in case of an error, otherwise the spreadsheet

readRange

public List<SpreadSheet> readRange(String filename)
Reads the spreadsheets from the given file.

Specified by:
readRange in interface MultiSheetSpreadSheetReader
Parameters:
filename - the file to read from
Returns:
the spreadsheets or null in case of an error

readRange

public List<SpreadSheet> readRange(InputStream stream)
Reads the spreadsheets from the stream. The caller must ensure to close the stream.

Specified by:
readRange in interface MultiSheetSpreadSheetReader
Parameters:
stream - the stream to read from
Returns:
the spreadsheets or null in case of an error

readRange

public List<SpreadSheet> readRange(Reader r)
Reads the spreadsheets from the given reader. The caller must ensure to close the reader.

Specified by:
readRange in interface MultiSheetSpreadSheetReader
Parameters:
r - the reader to read from
Returns:
the spreadsheets or null in case of an error

doReadRange

protected List<SpreadSheet> doReadRange(File file)
Performs the actual reading.

Default implementation returns null.

Parameters:
file - the file to read from
Returns:
the spreadsheets or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()

doReadRange

protected List<SpreadSheet> doReadRange(Reader r)
Performs the actual reading.

Default implementation returns null.

Parameters:
r - the reader to read from
Returns:
the spreadsheets or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()

doReadRange

protected List<SpreadSheet> doReadRange(InputStream in)
Performs the actual reading.

Default implementation returns null.

Parameters:
in - the input stream to read from
Returns:
the spreadsheets or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()

doRead

protected SpreadSheet doRead(File file)
Performs the actual reading.

Reads all defined sheets and returns only the first that it found.

Overrides:
doRead in class AbstractSpreadSheetReader
Parameters:
file - the file to read from
Returns:
the spreadsheet or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()

doRead

protected SpreadSheet doRead(Reader r)
Performs the actual reading.

Reads all defined sheets and returns only the first that it found.

Overrides:
doRead in class AbstractSpreadSheetReader
Parameters:
r - the reader to read from
Returns:
the spreadsheet or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()

doRead

protected SpreadSheet doRead(InputStream in)
Performs the actual reading.

Reads all defined sheets and returns only the first that it found.

Overrides:
doRead in class AbstractSpreadSheetReader
Parameters:
in - the input stream to read from
Returns:
the spreadsheet or null in case of an error
See Also:
AbstractSpreadSheetReader.getInputType()


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.