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 boolean
m_AlwaysQuoteText
whether to always quote text cells.protected boolean
m_Appending
whether to append spreadsheets.protected boolean
m_CheckFileExists
whether to check whether file exists with each data item being processed.protected String
m_Comment
the line comment.protected DateFormatString
m_DateFormat
the format string for the dates.protected DateFormat
m_DateFormatter
the date formatter.protected DateFormatString
m_DateTimeFormat
the format string for the date/times.protected DateFormat
m_DateTimeFormatter
the date/time formatter.protected DateFormatString
m_DateTimeMsecFormat
the format string for the date/time msecs.protected DateFormat
m_DateTimeMsecFormatter
the date/time msec formatter.protected boolean
m_EscapeSpecialChars
whether to escape special characters like \t, \n and \r.protected boolean
m_FileExists
whether the file already exists.protected SpreadSheet
m_Header
the header of the first spreadsheet written to file, if appending is active.protected boolean
m_IsAppending
whether the internal appending flag is one.protected boolean
m_KeepExisting
whether to keep existing files the first time the writer is called.protected String
m_NewLine
the new line.protected boolean
m_NoHeader
whether to skip outputting the header.protected boolean
m_OutputAsDisplayed
whether to output the cells as displayed (disable to output formulas).protected boolean
m_OutputComments
whether to output the comments.protected String
m_QuoteCharacter
the quote character.protected String
m_Separator
the column separator.protected DateFormatString
m_TimeFormat
the format string for the times.protected DateFormat
m_TimeFormatter
the time formatter.protected DateFormatString
m_TimeMsecFormat
the format string for the times with msec.protected DateFormat
m_TimeMsecFormatter
the time msec formatter.protected TimeZone
m_TimeZone
the 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 String
alwaysQuoteTextTipText()
Returns the tip text for this property.String
appendingTipText()
Returns the tip text for this property.boolean
canAppend(SpreadSheet sheet)
Checks whether we can append the specified spreadsheet to the existing file.protected void
checkFileExists(String filename)
Resets the header if them_CheckFileExists
flag is set and the file no longer exists.String
checkFileExistsTipText()
Returns the tip text for this property.String
commentTipText()
Returns the tip text for this property.String
dateFormatTipText()
Returns the tip date for this property.String
dateTimeFormatTipText()
Returns the tip date/time for this property.String
dateTimeMsecFormatTipText()
Returns the tip date/time for this property.void
defineOptions()
Adds options to the internal list of options.protected boolean
doWrite(Row content, Writer writer)
Performs the actual writing.protected boolean
doWrite(SpreadSheet content, Writer writer)
Performs the actual writing.protected boolean
doWriteHeader(Row header, Writer writer)
Writes the header.String
escapeSpecialCharsTipText()
Returns the tip text for this property.boolean
getAlwaysQuoteText()
Returns whether to always surround text/formula cells by double quotes.boolean
getCheckFileExists()
Returns whether check whether file exists with each data item being processed.String
getComment()
Returns the string denoting the start of a line comment.SpreadSheetReader
getCorrespondingReader()
Returns, if available, the corresponding reader.DateFormatString
getDateFormat()
Returns the format for date columns.protected DateFormat
getDateFormatter()
Returns the formatter for dates.DateFormatString
getDateTimeFormat()
Returns the format for date/time columns.protected DateFormat
getDateTimeFormatter()
Returns the formatter for date/times.DateFormatString
getDateTimeMsecFormat()
Returns the format for date/time msec columns.protected DateFormat
getDateTimeMsecFormatter()
Returns the formatter for date/time msecs.protected String
getDefaultSeparator()
Returns the default separator.boolean
getEscapeSpecialChars()
Returns whether to escape special chars like \\t, \\r and \\n with a backslash.boolean
getFileExists()
Returns whether the output file already exists.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.boolean
getKeepExisting()
Returns whether any existing file is kept on first execution.String
getNewLine()
Returns the string used as newline.boolean
getNoHeader()
Returns whether to use a header or not.boolean
getOutputAsDisplayed()
Returns whether to output the cell content as displayed, ie, no formulas but the result of formulas.boolean
getOutputComments()
Returns whether to output comments before the data.protected AbstractSpreadSheetWriter.OutputType
getOutputType()
Returns how the data is written.String
getQuoteCharacter()
Returns the string used as separator for the columns, '\t' for tab.String
getSeparator()
Returns the string used as separator for the columns, '\t' for tab.DateFormatString
getTimeFormat()
Returns the format for time columns.protected DateFormat
getTimeFormatter()
Returns the formatter for times.DateFormatString
getTimeMsecFormat()
Returns the format for time msec columns.protected DateFormat
getTimeMsecFormatter()
Returns the formatter for times with milli-seconds.TimeZone
getTimeZone()
Returns the time zone in use.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.boolean
isAppending()
Returns whether the next spreadsheet will get appended.boolean
isIncremental()
Returns whether the writer can write data incrementally.String
keepExistingTipText()
Returns the tip text for this property.String
newLineTipText()
Returns the tip text for this property.String
noHeaderTipText()
Returns the tip text for this property.String
outputAsDisplayedTipText()
Returns the tip text for this property.String
outputCommentsTipText()
Returns the tip text for this property.protected void
preWriteFile(String filename)
Hook method before writing to a file.String
quoteCharacterTipText()
Returns the tip text for this property.protected String
quoteNumber(String s)
Quotes the (numeric) string if necessary.protected String
quoteString(String s)
Quotes the string if necessary.void
reset()
Resets the writer.String
separatorTipText()
Returns the tip text for this property.void
setAlwaysQuoteText(boolean value)
Sets whether to always surround text/formula cells by double quotes.void
setAppending(boolean value)
Sets whether the next write call is to append the data to the existing file.void
setCheckFileExists(boolean value)
Sets whether to check whether file exists with each data item being proceossed.void
setComment(String value)
Sets the string denoting the start of a line comment.void
setDateFormat(DateFormatString value)
Sets the format for date columns.void
setDateTimeFormat(DateFormatString value)
Sets the format for date/time columns.void
setDateTimeMsecFormat(DateFormatString value)
Sets the format for date/time msec columns.void
setEscapeSpecialChars(boolean value)
Sets whether to escape special chars like \\t, \\r and \\n with a backslash.void
setFileExists(boolean value)
Sets whether the output file already exists.void
setKeepExisting(boolean value)
Sets whether to keep any existing file on first execution.void
setNewLine(String value)
Sets the string to use as newline.void
setNoHeader(boolean value)
Sets whether to use a header or not.void
setOutputAsDisplayed(boolean value)
Sets whether to output the cell content as displayed, ie, no formulas but the result of formulas.void
setOutputComments(boolean value)
Sets whether to output the comments before the data.void
setQuoteCharacter(String value)
Sets the character used for surrounding text.void
setSeparator(String value)
Sets the string to use as separator for the columns, use '\t' for tab.void
setTimeFormat(DateFormatString value)
Sets the format for time columns.void
setTimeMsecFormat(DateFormatString value)
Sets the format for time msec columns.void
setTimeZone(TimeZone value)
Sets the time zone to use.protected boolean
supportsCompressedOutput()
Returns whether to automatically compress.String
timeFormatTipText()
Returns the tip time for this property.String
timeMsecFormatTipText()
Returns the tip time for this property.String
timeZoneTipText()
Returns the tip text for this property.boolean
write(Row content, File file)
Writes the given content to the specified file.boolean
write(Row content, OutputStream stream)
Writes the spreadsheet to the given output stream.boolean
write(Row content, Writer writer)
Writes the spreadsheet to the given writer.boolean
write(Row content, String filename)
Writes the spreadsheet to the given file.protected boolean
writeHeader(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:
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 classAbstractFormattedSpreadSheetWriter
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractSpreadSheetWriter
-
reset
public void reset()
Resets the writer.- Specified by:
reset
in interfaceSpreadSheetWriter
- Overrides:
reset
in 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:
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
-
canAppend
public boolean canAppend(SpreadSheet sheet)
Checks whether we can append the specified spreadsheet to the existing file.- Specified by:
canAppend
in 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:
setAppending
in interfaceAppendableSpreadSheetWriter
- Parameters:
value
- true if to append
-
isAppending
public boolean isAppending()
Returns whether the next spreadsheet will get appended.- Specified by:
isAppending
in interfaceAppendableSpreadSheetWriter
- Returns:
- true if append is active
-
appendingTipText
public String appendingTipText()
Returns the tip text for this property.- Specified by:
appendingTipText
in 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:
setNoHeader
in interfaceNoHeaderSpreadSheetWriter
- Parameters:
value
- true if to skip header
-
getNoHeader
public boolean getNoHeader()
Returns whether to use a header or not.- Specified by:
getNoHeader
in interfaceNoHeaderSpreadSheetWriter
- Returns:
- true if no header
-
noHeaderTipText
public String noHeaderTipText()
Returns the tip text for this property.- Specified by:
noHeaderTipText
in 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:
setKeepExisting
in 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:
getKeepExisting
in interfaceAppendableSpreadSheetWriter
- Returns:
- true if existing file is kept
-
keepExistingTipText
public String keepExistingTipText()
Returns the tip text for this property.- Specified by:
keepExistingTipText
in 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:
setFileExists
in interfaceAppendableSpreadSheetWriter
- Parameters:
value
- true if the output file already exists
-
getFileExists
public boolean getFileExists()
Returns whether the output file already exists.- Specified by:
getFileExists
in 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:
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
-
supportsCompressedOutput
protected boolean supportsCompressedOutput()
Returns whether to automatically compress.- Overrides:
supportsCompressedOutput
in 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:
preWriteFile
in 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:
doWrite
in 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:
isIncremental
in 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:
write
in 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_CheckFileExists
flag 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:
write
in 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:
write
in 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:
write
in interfaceIncrementalSpreadSheetWriter
- Parameters:
content
- the spreadsheet to writewriter
- the writer to write the spreadsheet to- Returns:
- true if successfully written
-
-