public abstract class AbstractTableWriter extends Object implements TableWriter
| Constructor and Description |
|---|
AbstractTableWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the writer.
|
protected String |
convert(Object value)
Converts the value to its string representation.
|
protected String |
convert(String type,
Object value)
Converts the value to its string representation.
|
int |
getRowCount()
Returns the rows written.
|
protected TypeConversionHandler |
getTypeConversionHandler(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(String comment)
Prints a comment into the output stream.
|
void |
printComment(String comment,
int row,
int column)
Prints a comment into the output stream.
|
void |
printRow(Collection<?> columns)
Prints a single row into the CSV stream.
|
void |
printRow(Iterator<?> columns)
Prints a new row into the CSV stream.
|
void |
printRow(Iterator<?> columns,
int size)
Prints a single row into the CSV stream.
|
void |
registerTypeConversionHandler(TypeConversionHandler handler)
Registers a type conversion handler.
|
void |
unregisterTypeConversionHandler(TypeConversionHandler handler)
Unregisters a type conversion handler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprintRowprotected void init()
public void printComment(String comment) throws IOException
printComment in interface TableWritercomment - the comment to writeIOException - when an exception occurspublic void printComment(String comment, int row, int column) throws IOException
printComment in interface TableWritercomment - the comment to writerow - index of row for commentcolumn - index of column for commentIOException - when an exception occurspublic void close()
close in interface TableWriterpublic int getRowCount()
protected int incrementRowCount()
public void registerTypeConversionHandler(TypeConversionHandler handler)
handler - handler to registerpublic void unregisterTypeConversionHandler(TypeConversionHandler handler)
handler - handler to unregisterprotected TypeConversionHandler getTypeConversionHandler(String type)
type - type to get a handler forprotected String convert(Object value)
value - objectprotected String convert(String type, Object value)
type - type of object being returnedvalue - objectpublic void printRow(Collection<?> columns) throws IOException
printRow in interface TableWritercolumns - collection of column values. An iterator will be used to retrieve values from the collection.IOExceptionpublic void printRow(Iterator<?> columns, int size) throws IOException
printRow in interface TableWritercolumns - iterator that returns column values.size - number of values to retrieve from iterator. Method will abort at this size.IOExceptionpublic void printRow(Iterator<?> columns) throws IOException
printRow in interface TableWritercolumns - iterator that returns column values.IOExceptionCopyright © 2014. All rights reserved.