adams.data.io.output
Class AbstractMultiSheetSpreadSheetWriter

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
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, MultiSheetSpreadSheetWriter, SpreadSheetWriter, Serializable
Direct Known Subclasses:
AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport

public abstract class AbstractMultiSheetSpreadSheetWriter
extends AbstractSpreadSheetWriter
implements MultiSheetSpreadSheetWriter

Ancestor for spreadsheet writers that can write multiple sheets into a single document.

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

Field Summary
protected  String m_SheetPrefix
          The prefix for the sheet names.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractMultiSheetSpreadSheetWriter()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  boolean doWrite(SpreadSheet[] content, OutputStream out)
          Performs the actual writing.
protected  boolean doWrite(SpreadSheet[] content, Writer writer)
          Performs the actual writing.
protected  boolean doWrite(SpreadSheet content, OutputStream out)
          Performs the actual writing.
protected  boolean doWrite(SpreadSheet content, Writer writer)
          Performs the actual writing.
protected  String getDefaultSheetPrefix()
          Returns the default missing value.
 String getSheetPrefix()
          Returns the prefix for sheet names
 void setSheetPrefix(String value)
          Sets the prefix for sheet names.
 String sheetPrefixTipText()
          Returns the tip text for this property.
 boolean write(SpreadSheet[] content, File file)
          Writes the spreadsheets to the specified file.
 boolean write(SpreadSheet[] content, OutputStream stream)
          Writes the spreadsheets to the given output stream.
 boolean write(SpreadSheet[] content, String filename)
          Writes the spreadsheets to the given file.
 boolean write(SpreadSheet[] content, Writer writer)
          Writes the spreadsheets to the given writer.
 
Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter
getFormatDescription, getFormatExtensions, getUseOutputStream, getWriters, write, write, write, write
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, globalInfo, 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
getFormatDescription, getFormatExtensions, write, write, write, write
 
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
 
Methods inherited from interface adams.core.Destroyable
destroy
 

Field Detail

m_SheetPrefix

protected String m_SheetPrefix
The prefix for the sheet names.

Constructor Detail

AbstractMultiSheetSpreadSheetWriter

public AbstractMultiSheetSpreadSheetWriter()
Method Detail

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractOptionHandler

getDefaultSheetPrefix

protected String getDefaultSheetPrefix()
Returns the default missing value.

Returns:
the default for missing values

setSheetPrefix

public void setSheetPrefix(String value)
Sets the prefix for sheet names.

Parameters:
value - the prefix

getSheetPrefix

public String getSheetPrefix()
Returns the prefix for sheet names

Returns:
the prefix

sheetPrefixTipText

public String sheetPrefixTipText()
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,
                          Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.

Overrides:
doWrite in class AbstractSpreadSheetWriter
Parameters:
content - the spreadsheet to write
writer - the writer to write the spreadsheet to
Returns:
true if successfully written

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

doWrite

protected boolean doWrite(SpreadSheet[] content,
                          Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.

Default implementation returns always false.

Parameters:
content - the spreadsheet to write
writer - the writer to write the spreadsheet to
Returns:
true if successfully written

doWrite

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

Default implementation returns always false.

Parameters:
content - the spreadsheet to write
out - the output stream to write the spreadsheet to
Returns:
true if successfully written

write

public boolean write(SpreadSheet[] content,
                     File file)
Writes the spreadsheets to the specified file.

Specified by:
write in interface MultiSheetSpreadSheetWriter
Parameters:
content - the content to write
file - the file to write to
Returns:
true if successfully written

write

public boolean write(SpreadSheet[] content,
                     String filename)
Writes the spreadsheets to the given file.

Specified by:
write in interface MultiSheetSpreadSheetWriter
Parameters:
content - the spreadsheet to write
filename - the file to write the spreadsheet to
Returns:
true if successfully written

write

public boolean write(SpreadSheet[] content,
                     OutputStream stream)
Writes the spreadsheets to the given output stream. The caller must ensure that the stream gets closed.

Specified by:
write in interface MultiSheetSpreadSheetWriter
Parameters:
content - the spreadsheet to write
stream - the output stream to write the spreadsheet to
Returns:
true if successfully written

write

public boolean write(SpreadSheet[] content,
                     Writer writer)
Writes the spreadsheets to the given writer. The caller must ensure that the writer gets closed.

Specified by:
write in interface MultiSheetSpreadSheetWriter
Parameters:
content - the spreadsheet to write
writer - the writer to write the spreadsheet to
Returns:
true if successfully written


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