adams.core.io
Class GnumericSpreadSheetWriter

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

public class GnumericSpreadSheetWriter
extends AbstractSpreadSheetWriter

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
 
-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: 4584 $
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 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.core.io.AbstractSpreadSheetWriter
m_MissingValue
 
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.core.io.AbstractSpreadSheetWriter
doWrite, getDefaultMissingValue, getMissingValue, getWriters, missingValueTipText, setMissingValue, 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
 

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

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 AbstractSpreadSheetWriter

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 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 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 AbstractSpreadSheetWriter
Parameters:
content - the spreadsheet to write
out - the output stream to write the spreadsheet to
Returns:
true if successfully written


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