adams.data.io.output
Class GnumericSpreadSheetWriter

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.io.output.AbstractSpreadSheetWriter
              extended by adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
                  extended by adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
                      extended by adams.data.io.output.GnumericSpreadSheetWriter
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, MultiSheetSpreadSheetWriter, SpreadSheetWriter, Serializable

public class GnumericSpreadSheetWriter
extends AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport

Writes Gnumeric workbook files (GZIP compressed or uncompressed XML), version 1.10.13.

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: 
 
-creation-timestamp <adams.core.base.BaseDateTime> (property: creationTimestamp)
    The timestamp to use as creation date/time info in the file.
    default: NOW
 
-uncompressed (property: uncompressedOutput)
    If enabled, uncompressed XML instead of GZIP compressed output is generated.
 

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

Field Summary
protected  BaseDateTime m_CreationTimestamp
          the creation timestamp.
protected  boolean m_UncompressedOutput
          whether to use uncompressed output.
static String VALUETYPE_NUMERIC
          numeric cells.
static String VALUETYPE_STRING
          string cells.
static String VERSION
          the complete version.
static String VERSION_MAJOR
          the major version.
static String VERSION_MINOR
          the minor version.
static String VERSION_REVISION
          the revision version.
 
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.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
GnumericSpreadSheetWriter()
           
 
Method Summary
 String creationTimestampTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  boolean doWrite(SpreadSheet[] content, OutputStream out)
          Performs the actual writing.
protected  long getBound(SpreadSheet content, boolean cols)
          Returns the integer bound for number of columns/rows.
 BaseDateTime getCreationTimestamp()
          Returns the creation timestamp.
 String getFormatDescription()
          Returns a string describing the format (used in the file chooser).
 String[] getFormatExtensions()
          Returns the extension(s) of the format.
 boolean getUncompressedOutput()
          Returns whether to output uncompressed XML.
protected  boolean getUseOutputStream()
          Returns whether to write to an OutputStream rather than a Writer.
 String globalInfo()
          Returns a string describing the object.
 void setCreationTimestamp(BaseDateTime value)
          Sets the creation timestamp.
 void setUncompressedOutput(boolean value)
          Sets whether to output uncompressed XML.
 String uncompressedOutputTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport
getDefaultMissingValue, getMissingValue, missingValueTipText, setMissingValue
 
Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
doWrite, doWrite, doWrite, getDefaultSheetPrefix, getSheetPrefix, setSheetPrefix, sheetPrefixTipText, write, write, write, write
 
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter
getWriters, write, write, write, write
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, 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.output.SpreadSheetWriter
write, write, write, write
 
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
 
Methods inherited from interface adams.core.Destroyable
destroy
 

Field Detail

VERSION_MAJOR

public static final String VERSION_MAJOR
the major version.

See Also:
Constant Field Values

VERSION_MINOR

public static final String VERSION_MINOR
the minor version.

See Also:
Constant Field Values

VERSION_REVISION

public static final String VERSION_REVISION
the revision version.

See Also:
Constant Field Values

VERSION

public static final String VERSION
the complete version.

See Also:
Constant Field Values

VALUETYPE_NUMERIC

public static final String VALUETYPE_NUMERIC
numeric cells.

See Also:
Constant Field Values

VALUETYPE_STRING

public static final String VALUETYPE_STRING
string cells.

See Also:
Constant Field Values

m_CreationTimestamp

protected BaseDateTime m_CreationTimestamp
the creation timestamp.


m_UncompressedOutput

protected boolean m_UncompressedOutput
whether to use uncompressed output.

Constructor Detail

GnumericSpreadSheetWriter

public GnumericSpreadSheetWriter()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
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 interface OptionHandler
Overrides:
defineOptions in class AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport

setCreationTimestamp

public void setCreationTimestamp(BaseDateTime value)
Sets the creation timestamp.

Parameters:
value - the timestamp

getCreationTimestamp

public BaseDateTime getCreationTimestamp()
Returns the creation timestamp.

Returns:
the timestamp

creationTimestampTipText

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

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setUncompressedOutput

public void setUncompressedOutput(boolean value)
Sets whether to output uncompressed XML.

Parameters:
value - if true uncompressed XML is generated

getUncompressedOutput

public boolean getUncompressedOutput()
Returns whether to output uncompressed XML.

Returns:
true if uncompressed XML is generated

uncompressedOutputTipText

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

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getFormatDescription

public String getFormatDescription()
Returns a string describing the format (used in the file chooser).

Specified by:
getFormatDescription in interface SpreadSheetWriter
Specified by:
getFormatDescription in class AbstractSpreadSheetWriter
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 interface SpreadSheetWriter
Specified by:
getFormatExtensions in class AbstractSpreadSheetWriter
Returns:
the extension (without the dot!)

getUseOutputStream

protected boolean getUseOutputStream()
Returns whether to write to an OutputStream rather than a Writer.

Specified by:
getUseOutputStream in class AbstractSpreadSheetWriter
Returns:
true if to write to an OutputStream

getBound

protected long getBound(SpreadSheet content,
                        boolean cols)
Returns the integer bound for number of columns/rows.

Parameters:
content - the sheet to use as basis
cols - if true columns are checked, otherwise rows
Returns:
the bound (base 256)

doWrite

protected boolean doWrite(SpreadSheet[] content,
                          OutputStream out)
Performs the actual writing. The caller must ensure that the output stream gets closed.

Overrides:
doWrite in class AbstractMultiSheetSpreadSheetWriter
Parameters:
content - the spreadsheets to write
out - the output stream to write the spreadsheet to
Returns:
true if successfully written


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