Package adams.data.io.output
Class CsvSpreadSheetWriter
-
- All Implemented Interfaces:
AdditionalInformationHandler,Destroyable,GlobalInfoSupporter,EncodingSupporter,LoggingLevelHandler,LoggingSupporter,LocaleSupporter,OptionHandlingLocaleSupporter,OptionHandler,SizeOfHandler,Stoppable,StoppableWithFeedback,AppendableSpreadSheetWriter,IncrementalSpreadSheetWriter,NoHeaderSpreadSheetWriter,SpreadSheetWriter,SpreadSheetWriterWithFormulaSupport,Serializable
- Direct Known Subclasses:
TsvSpreadSheetWriter
public class CsvSpreadSheetWriter extends AbstractFormattedSpreadSheetWriter implements AppendableSpreadSheetWriter, SpreadSheetWriterWithFormulaSupport, IncrementalSpreadSheetWriter, NoHeaderSpreadSheetWriter
Writes CSV files.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-missing <java.lang.String> (property: missingValue) The placeholder for missing values. default:
-locale <java.util.Locale> (property: locale) The locale to use for formatting the numbers. default: Default
-number-format <java.lang.String> (property: numberFormat) The format for the numbers (see java.text.DecimalFormat), use empty string for default 'double' output. default:
-encoding <adams.core.base.BaseCharset> (property: encoding) The type of encoding to use when writing using a writer, use empty string for default. default: Default
-comment <java.lang.String> (property: comment) The string denoting the start of a line comment (comments can only precede header row). default: #
-output-comments <boolean> (property: outputComments) If enabled, any available comments are output before the actual data (using the 'comment' prefix). default: true
-output-as-displayed <boolean> (property: outputAsDisplayed) If enabled, cells are output as displayed, ie, results of formulas instead of the formulas. default: false
-no-header <boolean> (property: noHeader) If enabled, no header is output. default: false
-check-file-exists <boolean> (property: checkFileExists) If enabled, it is checked each time whether the file exists; expensive test if processing only one row at a time. default: false
-appending <boolean> (property: appending) If enabled, multiple spreadsheets with the same structure can be written to the same file. default: false
-keep-existing <boolean> (property: keepExisting) If enabled, any output file that exists when the writer is executed for the first time won't get replaced with the current header; useful when outputting data in multiple locations in the flow, but one needs to be cautious as to not stored mixed content (eg varying number of columns, etc). default: false
-quote-char <java.lang.String> (property: quoteCharacter) The character to use for surrounding text cells. default: \"
-separator <java.lang.String> (property: separator) The separator to use for the columns; use '\t' for tab. default: ,
-new-line <java.lang.String> (property: newLine) The newline character(s) to use for the columns; use '\r' for carriage return and '\n' for line feed; Linux/Unix use '\n', Windows uses '\r\n' and old Macs use '\r'. default: \\n
-always-quote-text <boolean> (property: alwaysQuoteText) If enabled, text/formula cells always get surrounded by double quotes. default: false
-escape-special-chars <boolean> (property: escapeSpecialChars) If enabled, special characters get escaped with a backslash: \\, \', \t, \n, \r, \" default: false
-date-format <adams.data.DateFormatString> (property: dateFormat) The format for dates. default: yyyy-MM-dd more: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
-datetime-format <adams.data.DateFormatString> (property: dateTimeFormat) The format for date/times. default: yyyy-MM-dd HH:mm:ss more: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
-datetimemsec-format <adams.data.DateFormatString> (property: dateTimeMsecFormat) The format for date/time msecs. default: yyyy-MM-dd HH:mm:ss.SSS more: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
-time-format <adams.data.DateFormatString> (property: timeFormat) The format for times. default: HH:mm:ss more: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
- 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 protected booleanm_AlwaysQuoteTextwhether to always quote text cells.protected booleanm_Appendingwhether to append spreadsheets.protected booleanm_CheckFileExistswhether to check whether file exists with each data item being processed.protected Stringm_Commentthe line comment.protected DateFormatStringm_DateFormatthe format string for the dates.protected DateFormatm_DateFormatterthe date formatter.protected DateFormatStringm_DateTimeFormatthe format string for the date/times.protected DateFormatm_DateTimeFormatterthe date/time formatter.protected DateFormatStringm_DateTimeMsecFormatthe format string for the date/time msecs.protected DateFormatm_DateTimeMsecFormatterthe date/time msec formatter.protected booleanm_EscapeSpecialCharswhether to escape special characters like \t, \n and \r.protected booleanm_FileExistswhether the file already exists.protected SpreadSheetm_Headerthe header of the first spreadsheet written to file, if appending is active.protected booleanm_IsAppendingwhether the internal appending flag is one.protected booleanm_KeepExistingwhether to keep existing files the first time the writer is called.protected Stringm_NewLinethe new line.protected booleanm_NoHeaderwhether to skip outputting the header.protected booleanm_OutputAsDisplayedwhether to output the cells as displayed (disable to output formulas).protected booleanm_OutputCommentswhether to output the comments.protected Stringm_QuoteCharacterthe quote character.protected Stringm_Separatorthe column separator.protected DateFormatStringm_TimeFormatthe format string for the times.protected DateFormatm_TimeFormatterthe time formatter.protected DateFormatStringm_TimeMsecFormatthe format string for the times with msec.protected DateFormatm_TimeMsecFormatterthe time msec formatter.protected TimeZonem_TimeZonethe timezone to use.-
Fields inherited from class adams.data.io.output.AbstractFormattedSpreadSheetWriter
m_Formatter, m_Locale, m_NumberFormat
-
Fields inherited from class adams.data.io.output.AbstractSpreadSheetWriterWithMissingValueSupport
m_MissingValue
-
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 CsvSpreadSheetWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringalwaysQuoteTextTipText()Returns the tip text for this property.StringappendingTipText()Returns the tip text for this property.booleancanAppend(SpreadSheet sheet)Checks whether we can append the specified spreadsheet to the existing file.protected voidcheckFileExists(String filename)Resets the header if them_CheckFileExistsflag is set and the file no longer exists.StringcheckFileExistsTipText()Returns the tip text for this property.StringcommentTipText()Returns the tip text for this property.StringdateFormatTipText()Returns the tip date for this property.StringdateTimeFormatTipText()Returns the tip date/time for this property.StringdateTimeMsecFormatTipText()Returns the tip date/time for this property.voiddefineOptions()Adds options to the internal list of options.protected booleandoWrite(Row content, Writer writer)Performs the actual writing.protected booleandoWrite(SpreadSheet content, Writer writer)Performs the actual writing.protected booleandoWriteHeader(Row header, Writer writer)Writes the header.StringescapeSpecialCharsTipText()Returns the tip text for this property.booleangetAlwaysQuoteText()Returns whether to always surround text/formula cells by double quotes.booleangetCheckFileExists()Returns whether check whether file exists with each data item being processed.StringgetComment()Returns the string denoting the start of a line comment.SpreadSheetReadergetCorrespondingReader()Returns, if available, the corresponding reader.DateFormatStringgetDateFormat()Returns the format for date columns.protected DateFormatgetDateFormatter()Returns the formatter for dates.DateFormatStringgetDateTimeFormat()Returns the format for date/time columns.protected DateFormatgetDateTimeFormatter()Returns the formatter for date/times.DateFormatStringgetDateTimeMsecFormat()Returns the format for date/time msec columns.protected DateFormatgetDateTimeMsecFormatter()Returns the formatter for date/time msecs.protected StringgetDefaultSeparator()Returns the default separator.booleangetEscapeSpecialChars()Returns whether to escape special chars like \\t, \\r and \\n with a backslash.booleangetFileExists()Returns whether the output file already exists.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.booleangetKeepExisting()Returns whether any existing file is kept on first execution.StringgetNewLine()Returns the string used as newline.booleangetNoHeader()Returns whether to use a header or not.booleangetOutputAsDisplayed()Returns whether to output the cell content as displayed, ie, no formulas but the result of formulas.booleangetOutputComments()Returns whether to output comments before the data.protected AbstractSpreadSheetWriter.OutputTypegetOutputType()Returns how the data is written.StringgetQuoteCharacter()Returns the string used as separator for the columns, '\t' for tab.StringgetSeparator()Returns the string used as separator for the columns, '\t' for tab.DateFormatStringgetTimeFormat()Returns the format for time columns.protected DateFormatgetTimeFormatter()Returns the formatter for times.DateFormatStringgetTimeMsecFormat()Returns the format for time msec columns.protected DateFormatgetTimeMsecFormatter()Returns the formatter for times with milli-seconds.TimeZonegetTimeZone()Returns the time zone in use.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.booleanisAppending()Returns whether the next spreadsheet will get appended.booleanisIncremental()Returns whether the writer can write data incrementally.StringkeepExistingTipText()Returns the tip text for this property.StringnewLineTipText()Returns the tip text for this property.StringnoHeaderTipText()Returns the tip text for this property.StringoutputAsDisplayedTipText()Returns the tip text for this property.StringoutputCommentsTipText()Returns the tip text for this property.protected voidpreWriteFile(String filename)Hook method before writing to a file.StringquoteCharacterTipText()Returns the tip text for this property.protected StringquoteNumber(String s)Quotes the (numeric) string if necessary.protected StringquoteString(String s)Quotes the string if necessary.voidreset()Resets the writer.StringseparatorTipText()Returns the tip text for this property.voidsetAlwaysQuoteText(boolean value)Sets whether to always surround text/formula cells by double quotes.voidsetAppending(boolean value)Sets whether the next write call is to append the data to the existing file.voidsetCheckFileExists(boolean value)Sets whether to check whether file exists with each data item being proceossed.voidsetComment(String value)Sets the string denoting the start of a line comment.voidsetDateFormat(DateFormatString value)Sets the format for date columns.voidsetDateTimeFormat(DateFormatString value)Sets the format for date/time columns.voidsetDateTimeMsecFormat(DateFormatString value)Sets the format for date/time msec columns.voidsetEscapeSpecialChars(boolean value)Sets whether to escape special chars like \\t, \\r and \\n with a backslash.voidsetFileExists(boolean value)Sets whether the output file already exists.voidsetKeepExisting(boolean value)Sets whether to keep any existing file on first execution.voidsetNewLine(String value)Sets the string to use as newline.voidsetNoHeader(boolean value)Sets whether to use a header or not.voidsetOutputAsDisplayed(boolean value)Sets whether to output the cell content as displayed, ie, no formulas but the result of formulas.voidsetOutputComments(boolean value)Sets whether to output the comments before the data.voidsetQuoteCharacter(String value)Sets the character used for surrounding text.voidsetSeparator(String value)Sets the string to use as separator for the columns, use '\t' for tab.voidsetTimeFormat(DateFormatString value)Sets the format for time columns.voidsetTimeMsecFormat(DateFormatString value)Sets the format for time msec columns.voidsetTimeZone(TimeZone value)Sets the time zone to use.protected booleansupportsCompressedOutput()Returns whether to automatically compress.StringtimeFormatTipText()Returns the tip time for this property.StringtimeMsecFormatTipText()Returns the tip time for this property.StringtimeZoneTipText()Returns the tip text for this property.booleanwrite(Row content, File file)Writes the given content to the specified file.booleanwrite(Row content, OutputStream stream)Writes the spreadsheet to the given output stream.booleanwrite(Row content, Writer writer)Writes the spreadsheet to the given writer.booleanwrite(Row content, String filename)Writes the spreadsheet to the given file.protected booleanwriteHeader(Row header, Writer writer)Writes the header, if necessary.-
Methods inherited from class adams.data.io.output.AbstractFormattedSpreadSheetWriter
format, getDefaultNumberFormat, getDefaultUseSimpleNumberFormat, getLocale, getNumberFormat, localeTipText, numberFormatTipText, setLocale, setNumberFormat
-
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriterWithMissingValueSupport
getDefaultMissingValue, getMissingValue, missingValueTipText, setMissingValue
-
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter
canCompress, doWrite, doWrite, encodingTipText, getAdditionalInformation, getDefaultFormatExtension, getEncoding, getWriters, isStopped, setEncoding, stopExecution, 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
write, write, write, write
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
Methods inherited from interface adams.core.StoppableWithFeedback
isStopped
-
-
-
-
Field Detail
-
m_Comment
protected String m_Comment
the line comment.
-
m_OutputComments
protected boolean m_OutputComments
whether to output the comments.
-
m_NoHeader
protected boolean m_NoHeader
whether to skip outputting the header.
-
m_Appending
protected boolean m_Appending
whether to append spreadsheets.
-
m_IsAppending
protected boolean m_IsAppending
whether the internal appending flag is one.
-
m_Header
protected SpreadSheet m_Header
the header of the first spreadsheet written to file, if appending is active.
-
m_KeepExisting
protected boolean m_KeepExisting
whether to keep existing files the first time the writer is called.
-
m_CheckFileExists
protected boolean m_CheckFileExists
whether to check whether file exists with each data item being processed.
-
m_FileExists
protected boolean m_FileExists
whether the file already exists.
-
m_OutputAsDisplayed
protected boolean m_OutputAsDisplayed
whether to output the cells as displayed (disable to output formulas).
-
m_QuoteCharacter
protected String m_QuoteCharacter
the quote character.
-
m_Separator
protected String m_Separator
the column separator.
-
m_NewLine
protected String m_NewLine
the new line.
-
m_AlwaysQuoteText
protected boolean m_AlwaysQuoteText
whether to always quote text cells.
-
m_EscapeSpecialChars
protected boolean m_EscapeSpecialChars
whether to escape special characters like \t, \n and \r.
-
m_DateFormat
protected DateFormatString m_DateFormat
the format string for the dates.
-
m_DateTimeFormat
protected DateFormatString m_DateTimeFormat
the format string for the date/times.
-
m_DateTimeMsecFormat
protected DateFormatString m_DateTimeMsecFormat
the format string for the date/time msecs.
-
m_TimeFormat
protected DateFormatString m_TimeFormat
the format string for the times.
-
m_TimeMsecFormat
protected DateFormatString m_TimeMsecFormat
the format string for the times with msec.
-
m_DateFormatter
protected transient DateFormat m_DateFormatter
the date formatter.
-
m_DateTimeFormatter
protected transient DateFormat m_DateTimeFormatter
the date/time formatter.
-
m_DateTimeMsecFormatter
protected transient DateFormat m_DateTimeMsecFormatter
the date/time msec formatter.
-
m_TimeFormatter
protected transient DateFormat m_TimeFormatter
the time formatter.
-
m_TimeMsecFormatter
protected transient DateFormat m_TimeMsecFormatter
the time msec formatter.
-
m_TimeZone
protected TimeZone m_TimeZone
the timezone to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractFormattedSpreadSheetWriter
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractSpreadSheetWriter
-
reset
public void reset()
Resets the writer.- Specified by:
resetin interfaceSpreadSheetWriter- Overrides:
resetin classAbstractSpreadSheetWriter
-
setComment
public void setComment(String value)
Sets the string denoting the start of a line comment.- Parameters:
value- the comment start
-
getComment
public String getComment()
Returns the string denoting the start of a line comment.- Returns:
- the comment start
-
commentTipText
public String commentTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputComments
public void setOutputComments(boolean value)
Sets whether to output the comments before the data.- Parameters:
value- true if to output comments
-
getOutputComments
public boolean getOutputComments()
Returns whether to output comments before the data.- Returns:
- true if to output comments
-
outputCommentsTipText
public String outputCommentsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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:
setOutputAsDisplayedin 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:
getOutputAsDisplayedin interfaceSpreadSheetWriterWithFormulaSupport- Returns:
- true if to output as displayed
-
outputAsDisplayedTipText
public String outputAsDisplayedTipText()
Returns the tip text for this property.- Specified by:
outputAsDisplayedTipTextin interfaceSpreadSheetWriterWithFormulaSupport- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
canAppend
public boolean canAppend(SpreadSheet sheet)
Checks whether we can append the specified spreadsheet to the existing file.- Specified by:
canAppendin interfaceAppendableSpreadSheetWriter- Parameters:
sheet- the spreadsheet to append to the existing one- Returns:
- true if appending is possible
-
setAppending
public void setAppending(boolean value)
Sets whether the next write call is to append the data to the existing file.- Specified by:
setAppendingin interfaceAppendableSpreadSheetWriter- Parameters:
value- true if to append
-
isAppending
public boolean isAppending()
Returns whether the next spreadsheet will get appended.- Specified by:
isAppendingin interfaceAppendableSpreadSheetWriter- Returns:
- true if append is active
-
appendingTipText
public String appendingTipText()
Returns the tip text for this property.- Specified by:
appendingTipTextin interfaceAppendableSpreadSheetWriter- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNoHeader
public void setNoHeader(boolean value)
Sets whether to use a header or not. file.- Specified by:
setNoHeaderin interfaceNoHeaderSpreadSheetWriter- Parameters:
value- true if to skip header
-
getNoHeader
public boolean getNoHeader()
Returns whether to use a header or not.- Specified by:
getNoHeaderin interfaceNoHeaderSpreadSheetWriter- Returns:
- true if no header
-
noHeaderTipText
public String noHeaderTipText()
Returns the tip text for this property.- Specified by:
noHeaderTipTextin interfaceNoHeaderSpreadSheetWriter- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setKeepExisting
public void setKeepExisting(boolean value)
Sets whether to keep any existing file on first execution.- Specified by:
setKeepExistingin interfaceAppendableSpreadSheetWriter- Parameters:
value- if true then existing file is kept
-
getKeepExisting
public boolean getKeepExisting()
Returns whether any existing file is kept on first execution.- Specified by:
getKeepExistingin interfaceAppendableSpreadSheetWriter- Returns:
- true if existing file is kept
-
keepExistingTipText
public String keepExistingTipText()
Returns the tip text for this property.- Specified by:
keepExistingTipTextin interfaceAppendableSpreadSheetWriter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCheckFileExists
public void setCheckFileExists(boolean value)
Sets whether to check whether file exists with each data item being proceossed.- Parameters:
value- true if to check
-
getCheckFileExists
public boolean getCheckFileExists()
Returns whether check whether file exists with each data item being processed.- Returns:
- true if to check
-
checkFileExistsTipText
public String checkFileExistsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setQuoteCharacter
public void setQuoteCharacter(String value)
Sets the character used for surrounding text.- Parameters:
value- the quote character
-
getQuoteCharacter
public String getQuoteCharacter()
Returns the string used as separator for the columns, '\t' for tab.- Returns:
- the separator
-
quoteCharacterTipText
public String quoteCharacterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSeparator
public void setSeparator(String value)
Sets the string to use as separator for the columns, use '\t' for tab.- Parameters:
value- the separator
-
getDefaultSeparator
protected String getDefaultSeparator()
Returns the default separator.- Returns:
- the default
-
getSeparator
public String getSeparator()
Returns the string used as separator for the columns, '\t' for tab.- Returns:
- the separator
-
separatorTipText
public String separatorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNewLine
public void setNewLine(String value)
Sets the string to use as newline.- Parameters:
value- the character(s)
-
getNewLine
public String getNewLine()
Returns the string used as newline.- Returns:
- the character(s)
-
newLineTipText
public String newLineTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlwaysQuoteText
public void setAlwaysQuoteText(boolean value)
Sets whether to always surround text/formula cells by double quotes.- Parameters:
value- true if to always quote
-
getAlwaysQuoteText
public boolean getAlwaysQuoteText()
Returns whether to always surround text/formula cells by double quotes.- Returns:
- true if append to always quote
-
alwaysQuoteTextTipText
public String alwaysQuoteTextTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setEscapeSpecialChars
public void setEscapeSpecialChars(boolean value)
Sets whether to escape special chars like \\t, \\r and \\n with a backslash.- Parameters:
value- true if to escape special chars
-
getEscapeSpecialChars
public boolean getEscapeSpecialChars()
Returns whether to escape special chars like \\t, \\r and \\n with a backslash.- Returns:
- true if to escape special chars
-
escapeSpecialCharsTipText
public String escapeSpecialCharsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDateFormat
public void setDateFormat(DateFormatString value)
Sets the format for date columns.- Parameters:
value- the format
-
getDateFormat
public DateFormatString getDateFormat()
Returns the format for date columns.- Returns:
- the format
-
dateFormatTipText
public String dateFormatTipText()
Returns the tip date for this property.- Returns:
- tip date for this property suitable for displaying in the gui
-
setDateTimeFormat
public void setDateTimeFormat(DateFormatString value)
Sets the format for date/time columns.- Parameters:
value- the format
-
getDateTimeFormat
public DateFormatString getDateTimeFormat()
Returns the format for date/time columns.- Returns:
- the format
-
dateTimeFormatTipText
public String dateTimeFormatTipText()
Returns the tip date/time for this property.- Returns:
- tip date for this property suitable for displaying in the gui
-
setDateTimeMsecFormat
public void setDateTimeMsecFormat(DateFormatString value)
Sets the format for date/time msec columns.- Parameters:
value- the format
-
getDateTimeMsecFormat
public DateFormatString getDateTimeMsecFormat()
Returns the format for date/time msec columns.- Returns:
- the format
-
dateTimeMsecFormatTipText
public String dateTimeMsecFormatTipText()
Returns the tip date/time for this property.- Returns:
- tip date for this property suitable for displaying in the gui
-
setTimeFormat
public void setTimeFormat(DateFormatString value)
Sets the format for time columns.- Parameters:
value- the format
-
getTimeFormat
public DateFormatString getTimeFormat()
Returns the format for time columns.- Returns:
- the format
-
timeFormatTipText
public String timeFormatTipText()
Returns the tip time for this property.- Returns:
- tip time for this property suitable for displaying in the gui
-
setTimeMsecFormat
public void setTimeMsecFormat(DateFormatString value)
Sets the format for time msec columns.- Parameters:
value- the format
-
getTimeMsecFormat
public DateFormatString getTimeMsecFormat()
Returns the format for time msec columns.- Returns:
- the format
-
timeMsecFormatTipText
public String timeMsecFormatTipText()
Returns the tip time for this property.- Returns:
- tip time for this property suitable for displaying in the gui
-
setTimeZone
public void setTimeZone(TimeZone value)
Sets the time zone to use.- Parameters:
value- the time zone
-
getTimeZone
public TimeZone getTimeZone()
Returns the time zone in use.- Returns:
- the time zone
-
timeZoneTipText
public String timeZoneTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setFileExists
public void setFileExists(boolean value)
Sets whether the output file already exists.- Specified by:
setFileExistsin interfaceAppendableSpreadSheetWriter- Parameters:
value- true if the output file already exists
-
getFileExists
public boolean getFileExists()
Returns whether the output file already exists.- Specified by:
getFileExistsin interfaceAppendableSpreadSheetWriter- Returns:
- true if the output file already exists
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceSpreadSheetWriter- Specified by:
getFormatDescriptionin classAbstractSpreadSheetWriter- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceSpreadSheetWriter- Specified by:
getFormatExtensionsin classAbstractSpreadSheetWriter- Returns:
- the extension (without the dot!)
-
getCorrespondingReader
public SpreadSheetReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Specified by:
getCorrespondingReaderin interfaceSpreadSheetWriter- Returns:
- the reader, null if none available
-
getOutputType
protected AbstractSpreadSheetWriter.OutputType getOutputType()
Returns how the data is written.- Specified by:
getOutputTypein classAbstractSpreadSheetWriter- Returns:
- the type
-
supportsCompressedOutput
protected boolean supportsCompressedOutput()
Returns whether to automatically compress.- Overrides:
supportsCompressedOutputin classAbstractSpreadSheetWriter- Returns:
- true if to automatically decompress
-
getDateFormatter
protected DateFormat getDateFormatter()
Returns the formatter for dates.- Returns:
- the formatter
-
getDateTimeFormatter
protected DateFormat getDateTimeFormatter()
Returns the formatter for date/times.- Returns:
- the formatter
-
getDateTimeMsecFormatter
protected DateFormat getDateTimeMsecFormatter()
Returns the formatter for date/time msecs.- Returns:
- the formatter
-
getTimeFormatter
protected DateFormat getTimeFormatter()
Returns the formatter for times.- Returns:
- the formatter
-
getTimeMsecFormatter
protected DateFormat getTimeMsecFormatter()
Returns the formatter for times with milli-seconds.- Returns:
- the formatter
-
quoteString
protected String quoteString(String s)
Quotes the string if necessary.- Parameters:
s- the string to quote, if necessary- Returns:
- the potentially quoted string
-
quoteNumber
protected String quoteNumber(String s)
Quotes the (numeric) string if necessary.- Parameters:
s- the (numeric) string to quote, if necessary- Returns:
- the potentially quoted string
-
doWriteHeader
protected boolean doWriteHeader(Row header, Writer writer)
Writes the header.- Parameters:
header- the header row to writewriter- the writer to write the header to
-
writeHeader
protected boolean writeHeader(Row header, Writer writer)
Writes the header, if necessary.- Parameters:
header- the header row to writewriter- the writer to write the header to
-
doWrite
protected boolean doWrite(Row content, Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.- Parameters:
content- the row to writewriter- the writer to write the spreadsheet to- Returns:
- true if successfully written
-
preWriteFile
protected void preWriteFile(String filename)
Hook method before writing to a file.- Overrides:
preWriteFilein classAbstractSpreadSheetWriter- Parameters:
filename- the filename to check
-
doWrite
protected boolean doWrite(SpreadSheet content, Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.- Overrides:
doWritein classAbstractSpreadSheetWriter- Parameters:
content- the spreadsheet to writewriter- the writer to write the spreadsheet to- Returns:
- true if successfully written
-
isIncremental
public boolean isIncremental()
Returns whether the writer can write data incrementally.- Specified by:
isIncrementalin interfaceIncrementalSpreadSheetWriter- Returns:
- true if data can be written incrementally
-
write
public boolean write(Row content, File file)
Writes the given content to the specified file.- Specified by:
writein interfaceIncrementalSpreadSheetWriter- Parameters:
content- the content to writefile- the file to write to- Returns:
- true if successfully written
-
checkFileExists
protected void checkFileExists(String filename)
Resets the header if them_CheckFileExistsflag is set and the file no longer exists.- Parameters:
filename- the file to check
-
write
public boolean write(Row content, String filename)
Writes the spreadsheet to the given file.- Specified by:
writein interfaceIncrementalSpreadSheetWriter- Parameters:
content- the spreadsheet to writefilename- the file to write the spreadsheet to- Returns:
- true if successfully written
-
write
public boolean write(Row content, OutputStream stream)
Writes the spreadsheet to the given output stream. The caller must ensure that the stream gets closed.- Specified by:
writein interfaceIncrementalSpreadSheetWriter- Parameters:
content- the spreadsheet to writestream- the output stream to write the spreadsheet to- Returns:
- true if successfully written
-
write
public boolean write(Row content, Writer writer)
Writes the spreadsheet to the given writer. The caller must ensure that the writer gets closed.- Specified by:
writein interfaceIncrementalSpreadSheetWriter- Parameters:
content- the spreadsheet to writewriter- the writer to write the spreadsheet to- Returns:
- true if successfully written
-
-