Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.

csv.impl
Class AbstractTableWriter

java.lang.Object
  extended by csv.impl.AbstractTableWriter
All Implemented Interfaces:
TableWriter
Direct Known Subclasses:
AbstractStreamTableWriter

public abstract class AbstractTableWriter
extends java.lang.Object
implements TableWriter

Abstract implementation of writer interface. The interface provides basic functionality being needed regardless of underlying medium to be written to.

Author:
ralph

Constructor Summary
AbstractTableWriter()
           
 
Method Summary
 void close()
          Closes the writer.
protected  java.lang.String convert(java.lang.Object value)
          Converts the value to its string representation.
protected  java.lang.String convert(java.lang.String type, java.lang.Object value)
          Converts the value to its string representation.
 int getRowCount()
          Returns the rows written.
protected  TypeConversionHandler getTypeConversionHandler(java.lang.String type)
          Returns a type conversion handler for the given type.
protected  int incrementRowCount()
          Increments the row count.
protected  void init()
          General initialization.
 void printComment(java.lang.String comment)
          Prints a comment into the output stream.
 void printComment(java.lang.String comment, int row, int column)
          Prints a comment into the output stream.
 void registerTypeConversionHandler(TypeConversionHandler handler)
          Registers a type conversion handler.
 void unregisterTypeConversionHandler(TypeConversionHandler handler)
          Unregisters a type conversion handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface csv.TableWriter
printRow
 

Constructor Detail

AbstractTableWriter

public AbstractTableWriter()
Method Detail

init

protected void init()
General initialization. This implementation does nothing.


printComment

public void printComment(java.lang.String comment)
                  throws java.io.IOException
Prints a comment into the output stream. This implementation does nothing by default.

Specified by:
printComment in interface TableWriter
Parameters:
comment - the comment to write
Throws:
java.io.IOException - when an exception occurs

printComment

public void printComment(java.lang.String comment,
                         int row,
                         int column)
                  throws java.io.IOException
Prints a comment into the output stream. This implementation does nothing by default.

Specified by:
printComment in interface TableWriter
Parameters:
comment - the comment to write
row - index of row for comment
column - index of column for comment
Throws:
java.io.IOException - when an exception occurs

close

public void close()
Closes the writer. This implementation does nothing.

Specified by:
close in interface TableWriter

getRowCount

public int getRowCount()
Returns the rows written.

Returns:
the rowCount

incrementRowCount

protected int incrementRowCount()
Increments the row count.

Returns:
current row count

registerTypeConversionHandler

public void registerTypeConversionHandler(TypeConversionHandler handler)
Registers a type conversion handler.

Parameters:
handler - handler to register

unregisterTypeConversionHandler

public void unregisterTypeConversionHandler(TypeConversionHandler handler)
Unregisters a type conversion handler.

Parameters:
handler - handler to unregister

getTypeConversionHandler

protected TypeConversionHandler getTypeConversionHandler(java.lang.String type)
Returns a type conversion handler for the given type.

Parameters:
type - type to get a handler for
Returns:
conversion handler

convert

protected java.lang.String convert(java.lang.Object value)
Converts the value to its string representation.

Parameters:
value - object
Returns:
string representation

convert

protected java.lang.String convert(java.lang.String type,
                                   java.lang.Object value)
Converts the value to its string representation.

Parameters:
type - type of object being returned
value - object
Returns:
string representation

Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.

Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.