Package adams.data.io.output
Class ExcelStreamingSpreadSheetWriter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.output.AbstractSpreadSheetWriter
-
- adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
-
- adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
-
- adams.data.io.output.ExcelStreamingSpreadSheetWriter
-
- All Implemented Interfaces:
AdditionalInformationHandler
,Destroyable
,GlobalInfoSupporter
,EncodingSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,MultiSheetSpreadSheetWriter
,SpreadSheetWriter
,SpreadSheetWriterWithFormulaSupport
,Serializable
public class ExcelStreamingSpreadSheetWriter extends AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport implements SpreadSheetWriterWithFormulaSupport
Writes OOXML MS Excel files in streaming mode (more memory efficient).
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-sheet-prefix <java.lang.String> (property: sheetPrefix) The prefix for sheet names. default: Sheet
-missing <java.lang.String> (property: missingValue) The placeholder for missing values. default:
-output-as-displayed (property: outputAsDisplayed) If enabled, cells are output as displayed, ie, results of formulas instead of the formulas.
-max-rows <int> (property: maxRows) The maximum number of rows to keep in memory. default: 100 minimum: 1
- Version:
- $Revision$
- 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.output.AbstractSpreadSheetWriter
AbstractSpreadSheetWriter.OutputType
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILE_EXTENSION
the OOXML file extension.protected int
m_MaxRows
the number of rows to keep in memory.protected boolean
m_OutputAsDisplayed
whether to output the cells as displayed (disable to output formulas).-
Fields inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
m_MissingValue
-
Fields inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
m_SheetPrefix
-
Fields inherited from class adams.data.io.output.AbstractSpreadSheetWriter
m_Encoding, m_Stopped
-
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 ExcelStreamingSpreadSheetWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected boolean
doWrite(SpreadSheet[] content, OutputStream out)
Performs the actual writing.SpreadSheetReader
getCorrespondingReader()
Returns, if available, the corresponding reader.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.int
getMaxRows()
Returns the maximum number of rows to keep in memory.boolean
getOutputAsDisplayed()
Returns whether to output the cell content as displayed, ie, no formulas but the result of formulas.protected AbstractSpreadSheetWriter.OutputType
getOutputType()
Returns how the data is written.String
globalInfo()
Returns a string describing the object.String
maxRowsTipText()
Returns the tip text for this property.String
outputAsDisplayedTipText()
Returns the tip text for this property.void
setMaxRows(int value)
Sets the maximum number of rows to keep in memory.void
setOutputAsDisplayed(boolean value)
Sets whether to output the cell content as displayed, ie, no formulas but the result of formulas.-
Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
getDefaultMissingValue, getMissingValue, missingValueTipText, setMissingValue
-
Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
canWriteMultiple, doWrite, doWrite, doWrite, doWrite, getDefaultSheetPrefix, getSheetPrefix, setSheetPrefix, sheetPrefixTipText, write, write, write, write
-
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter
canCompress, doWrite, encodingTipText, getAdditionalInformation, getDefaultFormatExtension, getEncoding, getWriters, initialize, isStopped, preWriteFile, reset, setEncoding, stopExecution, supportsCompressedOutput, write, write, write, write
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, 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.output.SpreadSheetWriter
reset, write, write, write, write
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
Methods inherited from interface adams.core.StoppableWithFeedback
isStopped
-
-
-
-
Field Detail
-
FILE_EXTENSION
public static String FILE_EXTENSION
the OOXML file extension.
-
m_OutputAsDisplayed
protected boolean m_OutputAsDisplayed
whether to output the cells as displayed (disable to output formulas).
-
m_MaxRows
protected int m_MaxRows
the number of rows to keep in memory.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceSpreadSheetWriter
- Specified by:
getFormatDescription
in classAbstractSpreadSheetWriter
- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensions
in interfaceSpreadSheetWriter
- Specified by:
getFormatExtensions
in classAbstractSpreadSheetWriter
- Returns:
- the extension (without the dot!)
-
getCorrespondingReader
public SpreadSheetReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Specified by:
getCorrespondingReader
in interfaceSpreadSheetWriter
- Returns:
- the reader, null if none available
-
getOutputType
protected AbstractSpreadSheetWriter.OutputType getOutputType()
Returns how the data is written.- Specified by:
getOutputType
in classAbstractSpreadSheetWriter
- Returns:
- the type
-
setOutputAsDisplayed
public void setOutputAsDisplayed(boolean value)
Sets whether to output the cell content as displayed, ie, no formulas but the result of formulas.- Specified by:
setOutputAsDisplayed
in interfaceSpreadSheetWriterWithFormulaSupport
- Parameters:
value
- true if to output as displayed
-
getOutputAsDisplayed
public boolean getOutputAsDisplayed()
Returns whether to output the cell content as displayed, ie, no formulas but the result of formulas.- Specified by:
getOutputAsDisplayed
in interfaceSpreadSheetWriterWithFormulaSupport
- Returns:
- true if to output as displayed
-
outputAsDisplayedTipText
public String outputAsDisplayedTipText()
Returns the tip text for this property.- Specified by:
outputAsDisplayedTipText
in interfaceSpreadSheetWriterWithFormulaSupport
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxRows
public void setMaxRows(int value)
Sets the maximum number of rows to keep in memory.- Parameters:
value
- the number of rows
-
getMaxRows
public int getMaxRows()
Returns the maximum number of rows to keep in memory.- Returns:
- the number of rows
-
maxRowsTipText
public String maxRowsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
doWrite
protected boolean doWrite(SpreadSheet[] content, OutputStream out)
Performs the actual writing. The caller must ensure that the writer gets closed.- Overrides:
doWrite
in classAbstractMultiSheetSpreadSheetWriter
- Parameters:
content
- the spreadsheet to writeout
- the writer to write the spreadsheet to- Returns:
- true if successfully written
-
-