public class CSVUtils extends Object
| Constructor and Description |
|---|
CSVUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String[] |
convertArray(Object[] columns,
int minLength)
Returns an array from the columns.
|
static Object[] |
convertList(List<?> columns,
int minLength)
Trims array to correct length of minimum column count.
|
static int |
copy(Collection<? extends Object[]> collection,
TableWriter writer)
Copies the arrays from the collection to the stream.
|
static int |
copy(Iterator<? extends Object[]> i,
TableWriter writer)
Copies the arrays from the iterator to the stream.
|
static void |
copy(JTable table,
TableWriter writer,
boolean writeHeaderRow,
boolean selectedOnly)
Deprecated.
|
static int |
copy(Object[][] arr,
TableWriter writer)
Copies the arrays from the iterator to the stream.
|
static void |
copy(ResultSet resultSet,
TableWriter writer,
boolean writeHeaderRow)
Deprecated.
|
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 <T> int |
copyBeans(Collection<T> collection,
TableWriter writer)
Copies the beans from the collection to the stream.
|
static <T> int |
copyBeans(Iterator<T> i,
TableWriter writer)
Copies the beans from the collection to the stream.
|
static <T> int |
copyBeans(T[] arr,
TableWriter writer)
Copies the beans from the array to the stream.
|
static void |
copyHeader(ResultSet resultSet,
TableWriter writer)
Copies the header of the JDBC result set into the table writer.
|
static void |
copyTableHeader(JTableHeader tableHeader,
TableWriter writer)
Copies the table header into the table writer.
|
static Object[] |
extendArray(Object[] columns,
int minLength)
Trims array to correct length of minimum column count.
|
static String[] |
extendArray(String[] columns,
int minLength)
Trims array to correct length of minimum column count.
|
static Charset |
getDefaultCharset()
Returns the
defaultCharset. |
static void |
setDefaultCharset(Charset defaultCharset)
Sets the
defaultCharset. |
static void |
setDefaultCharset(String defaultCharset)
Sets the
defaultCharset. |
public static Charset getDefaultCharset()
defaultCharset.public static void setDefaultCharset(Charset defaultCharset)
defaultCharset.defaultCharset - the defaultCharset to setpublic static void setDefaultCharset(String defaultCharset)
defaultCharset.defaultCharset - the defaultCharset to setpublic static void copyHeader(ResultSet resultSet, TableWriter writer) throws Exception
resultSet - result set to copywriter - CSV writer to write toException - if an exception occurspublic static void copy(ResultSet resultSet, TableWriter writer, boolean writeHeaderRow) throws Exception
resultSet - result set to copywriter - table writer to write towriteHeaderRow - whether header row shall be writtenException - if an exception occurspublic static void copyTableHeader(JTableHeader tableHeader, TableWriter writer) throws Exception
tableHeader - table header to get content fromwriter - table writerException - when an exception occurspublic static void copy(JTable table, TableWriter writer, boolean writeHeaderRow, boolean selectedOnly) throws Exception
table - table to get content fromwriter - table writerwriteHeaderRow - whether header row shall be writtenselectedOnly - whether selected rows shall be written onlyException - when an exception occurspublic static void copy(TableReader reader, TableWriter writer) throws Exception
reader - reader to copy data fromwriter - writer to write data toException - when an exception occurspublic static void copy(TableReader reader, TableWriter writer, boolean copyHeaderRow) throws 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)Exception - when an exception occurspublic static int copy(Collection<? extends Object[]> collection, TableWriter writer) throws IOException
collection - collection that contains rowswriter - writer to write rows toIOException - when there is a problem with the writer.public static int copy(Iterator<? extends Object[]> i, TableWriter writer) throws IOException
i - iterator that delivers rowswriter - writer to write rows toIOException - when there is a problem with the writer.public static int copy(Object[][] arr, TableWriter writer) throws IOException
arr - two-dimensional array with rows and columnswriter - writer to write rows toIOException - when there is a problem with the writer.public static <T> int copyBeans(Collection<T> collection, TableWriter writer) throws IOException
BeanWritercollection - collection that contains JavaBeanswriter - writer to write rows toIOException - when there is a problem with the writer.public static <T> int copyBeans(Iterator<T> i, TableWriter writer) throws IOException
BeanWriteri - iterator that delivers JavaBeanswriter - writer to write rows toIOException - when there is a problem with the writer.public static <T> int copyBeans(T[] arr,
TableWriter writer)
throws IOException
BeanWriterarr - array of JavaBeanswriter - writer to write rows toIOException - when there is a problem with the writer.public static String[] convertArray(Object[] columns, int minLength)
columns - columns to returnminLength - minimum number of columns in return arraypublic static Object[] extendArray(Object[] columns, int minLength)
columns - minimum columnspublic static String[] extendArray(String[] columns, int minLength)
columns - minimum columnsCopyright © 2014. All rights reserved.