Package adams.data.io.input
Class AbstractMultiSheetSpreadSheetReader<T extends Range>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractSpreadSheetReader
-
- adams.data.io.input.AbstractMultiSheetSpreadSheetReader<T>
-
- All Implemented Interfaces:
AdditionalInformationHandler
,Destroyable
,ErrorProvider
,GlobalInfoSupporter
,EncodingSupporter
,FileFormatHandler
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,MultiSheetSpreadSheetReader<T>
,SpreadSheetReader
,DataRowTypeHandler
,SpreadSheetTypeHandler
,Serializable
- Direct Known Subclasses:
AbstractMultiSheetSpreadSheetReaderWithMissingValueSupport
,Mat5SpreadSheetReader
public abstract class AbstractMultiSheetSpreadSheetReader<T extends Range> extends AbstractSpreadSheetReader implements MultiSheetSpreadSheetReader<T>
Ancestor for spreadsheet readers that can read multiple sheets from a document in one go.- 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
Fields Modifier and Type Field Description protected T
m_SheetRange
the range of sheets to load.-
Fields inherited from class adams.data.io.input.AbstractSpreadSheetReader
m_DataRowType, m_Encoding, m_LastError, m_SpreadSheetType, m_Stopped, OPTION_INPUT, OPTION_OUTPUT
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractMultiSheetSpreadSheetReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.protected abstract T
getDefaultSheetRange()
Returns the default sheet range.T
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(T 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
canDecompress, check, dataRowTypeTipText, encodingTipText, getAdditionalInformation, getDataRowType, getDefaultDataRowType, getDefaultFormatExtension, getDefaultSpreadSheet, getEncoding, getFormatDescription, getFormatExtensions, getInputType, getLastError, getReaders, getSpreadSheetType, hasLastError, initialize, isStopped, read, read, read, read, runReader, setDataRowType, setEncoding, setLastError, setSpreadSheetType, spreadSheetTypeTipText, stopExecution, supportsCompressedInput
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.data.io.input.SpreadSheetReader
dataRowTypeTipText, getCorrespondingWriter, getDataRowType, getDefaultFormatExtension, getFormatDescription, getFormatExtensions, getLastError, getSpreadSheetType, hasLastError, isStopped, read, read, read, read, setDataRowType, setSpreadSheetType, spreadSheetTypeTipText, stopExecution
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractSpreadSheetReader
-
getDefaultSheetRange
protected abstract T getDefaultSheetRange()
Returns the default sheet range.- Returns:
- the default
-
setSheetRange
public void setSheetRange(T value)
Sets the range of the sheets to load.- Specified by:
setSheetRange
in interfaceMultiSheetSpreadSheetReader<T extends Range>
- Parameters:
value
- the range (1-based)
-
getSheetRange
public T getSheetRange()
Returns the range of the sheets to load.- Specified by:
getSheetRange
in interfaceMultiSheetSpreadSheetReader<T extends Range>
- Returns:
- the range (1-based)
-
sheetRangeTipText
public String sheetRangeTipText()
Returns the tip text for this property.- Specified by:
sheetRangeTipText
in interfaceMultiSheetSpreadSheetReader<T extends Range>
- 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 interfaceMultiSheetSpreadSheetReader<T extends Range>
- 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 interfaceMultiSheetSpreadSheetReader<T extends Range>
- 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 interfaceMultiSheetSpreadSheetReader<T extends Range>
- 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 interfaceMultiSheetSpreadSheetReader<T extends Range>
- 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 classAbstractSpreadSheetReader
- 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 classAbstractSpreadSheetReader
- 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 classAbstractSpreadSheetReader
- Parameters:
in
- the input stream to read from- Returns:
- the spreadsheet or null in case of an error
- See Also:
AbstractSpreadSheetReader.getInputType()
-
-