|
Copyright © 2008-2011 Ralph Schuster. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsv.util.CSVUtils
public class CSVUtils
Various methods for working with TableReader and TableWriter. This class provides useful method for easily copying table-like data from either JDBC results, JTable or table readers into table writers.
| Constructor Summary | |
|---|---|
CSVUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String[] |
convertArray(java.lang.Object[] columns,
int minLength)
Returns an array from the columns. |
static java.lang.Object[] |
convertList(java.util.List<java.lang.Object> columns,
int minLength)
Trims array to correct length of minimum column count. |
static int |
copy(java.util.Collection<? extends java.lang.Object[]> collection,
TableWriter writer)
Copies the arrays from the collection to the stream. |
static int |
copy(java.util.Iterator<? extends java.lang.Object[]> i,
TableWriter writer)
Copies the arrays from the iterator to the stream. |
static void |
copy(javax.swing.JTable table,
TableWriter writer,
boolean writeHeaderRow,
boolean selectedOnly)
Deprecated. Use JTableReader and copy(TableReader, TableWriter, boolean) |
static int |
copy(java.lang.Object[][] arr,
TableWriter writer)
Copies the arrays from the iterator to the stream. |
static void |
copy(java.sql.ResultSet resultSet,
TableWriter writer,
boolean writeHeaderRow)
Deprecated. Use JdbcReader and copy(TableReader, TableWriter, boolean) |
static void |
copy(TableReader reader,
TableWriter writer)
Copies content from one reader to another writer without header row. |
static void |
copy(TableReader reader,
TableWriter writer,
boolean copyHeaderRow)
Copies content from one reader to another writer. |
static int |
copyBeans(java.util.Collection<? extends java.lang.Object> collection,
TableWriter writer)
Copies the beans from the collection to the stream. |
static int |
copyBeans(java.util.Iterator<? extends java.lang.Object> i,
TableWriter writer)
Copies the beans from the collection to the stream. |
static int |
copyBeans(java.lang.Object[] arr,
TableWriter writer)
Copies the beans from the array to the stream. |
static void |
copyHeader(java.sql.ResultSet resultSet,
TableWriter writer)
Copies the header of the JDBC result set into the table writer. |
static void |
copyTableHeader(javax.swing.table.JTableHeader tableHeader,
TableWriter writer)
Copies the table header into the table writer. |
static java.lang.Object[] |
extendArray(java.lang.Object[] columns,
int minLength)
Trims array to correct length of minimum column count. |
static java.lang.String[] |
extendArray(java.lang.String[] columns,
int minLength)
Trims array to correct length of minimum column count. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CSVUtils()
| Method Detail |
|---|
public static void copyHeader(java.sql.ResultSet resultSet,
TableWriter writer)
throws java.lang.Exception
resultSet - result set to copywriter - CSV writer to write to
java.lang.Exception - if an exception occurs
public static void copy(java.sql.ResultSet resultSet,
TableWriter writer,
boolean writeHeaderRow)
throws java.lang.Exception
JdbcReader and copy(TableReader, TableWriter, boolean)
resultSet - result set to copywriter - table writer to write towriteHeaderRow - whether header row shall be written
java.lang.Exception - if an exception occurs
public static void copyTableHeader(javax.swing.table.JTableHeader tableHeader,
TableWriter writer)
throws java.lang.Exception
tableHeader - table header to get content fromwriter - table writer
java.lang.Exception - when an exception occurs
public static void copy(javax.swing.JTable table,
TableWriter writer,
boolean writeHeaderRow,
boolean selectedOnly)
throws java.lang.Exception
JTableReader and copy(TableReader, TableWriter, boolean)
table - table to get content fromwriter - table writerwriteHeaderRow - whether header row shall be writtenselectedOnly - whether selected rows shall be written only
java.lang.Exception - when an exception occurs
public static void copy(TableReader reader,
TableWriter writer)
throws java.lang.Exception
reader - reader to copy data fromwriter - writer to write data to
java.lang.Exception - when an exception occurs
public static void copy(TableReader reader,
TableWriter writer,
boolean copyHeaderRow)
throws java.lang.Exception
reader - reader to copy data fromwriter - writer to write data tocopyHeaderRow - whether a header row shall be copied too (only if reader supports it)
java.lang.Exception - when an exception occurs
public static int copy(java.util.Collection<? extends java.lang.Object[]> collection,
TableWriter writer)
throws java.io.IOException
collection - collection that contains rowswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static int copy(java.util.Iterator<? extends java.lang.Object[]> i,
TableWriter writer)
throws java.io.IOException
i - iterator that delivers rowswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static int copy(java.lang.Object[][] arr,
TableWriter writer)
throws java.io.IOException
arr - two-dimensional array with rows and columnswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static int copyBeans(java.util.Collection<? extends java.lang.Object> collection,
TableWriter writer)
throws java.io.IOException
BeanWriter
collection - collection that contains JavaBeanswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static int copyBeans(java.util.Iterator<? extends java.lang.Object> i,
TableWriter writer)
throws java.io.IOException
BeanWriter
i - iterator that delivers JavaBeanswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static int copyBeans(java.lang.Object[] arr,
TableWriter writer)
throws java.io.IOException
BeanWriter
arr - array of JavaBeanswriter - writer to write rows to
java.io.IOException - when there is a problem with the writer.
public static java.lang.String[] convertArray(java.lang.Object[] columns,
int minLength)
columns - columns to returnminLength - minimum number of columns in return array
public static java.lang.Object[] extendArray(java.lang.Object[] columns,
int minLength)
columns - minimum columns
public static java.lang.String[] extendArray(java.lang.String[] columns,
int minLength)
columns - minimum columns
public static java.lang.Object[] convertList(java.util.List<java.lang.Object> columns,
int minLength)
columns - minimum columns
|
Copyright © 2008-2011 Ralph Schuster. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||