Modifier and Type | Method and Description |
---|---|
static String |
csvColumnToString(Object column,
Formatter formatter)
Formats the supplied column using the supplied formatter.
|
static String |
csvRowFromValues(Character separator,
Formatter formatter,
Object... values)
Converts the supplied values to a single String consisting of properly
quoted columns (that are converted to a String using the supplied
formatter), separated by the supplied column separator.
|
static String |
csvRowFromValues(Character separator,
Object... values)
Converts the supplied values to a single String consisting of properly
quoted columns, separated by the supplied column separator.
|
static String |
objectToCsvRow(Object object,
List<Method> getters,
Formatter formatter,
Character columnSeparator)
Converts the supplied object to a single row of csv data.
|
static String |
quoteCsv(String field,
Character separator)
Quotes a csv (comma separated value) field.
|
static String[] |
splitRow(String row,
Character columnSeparator)
Splits a row of csv data into columns.
|
static String |
stripSurroundingQuotes(String column)
Strips the supplied column from optional surrounding quotes.
|
public static String csvRowFromValues(Character separator, Object... values)
quoteCsv(String, Character)
to properly
quote each individual field.values
- Each value represents a column that needs to be converted
to a String, then must be properly quoted and then separated from the
next column.separator
- The separator to separate the supplied values.
public static String csvRowFromValues(Character separator, Formatter formatter, Object... values)
quoteCsv(String, Character)
to properly
quote each individual field.separator
- The separator to separate the supplied values.
formatter
- The formatter to convert the supplied values to a
String.values
- Each value represents a column that needs to be converted
to a String using the supplied formatter, then must be properly quoted
and then separated from the next column.NullPointerException
- When the supplied formatter is null.public static String quoteCsv(String field, Character separator)
field
- The csv field to be quoted.separator
- The separator to separate the different fields.NullPointerException
- When the supplied separator is null.public static String[] splitRow(String row, Character columnSeparator)
row
- A row containing csv data.columnSeparator
- The separator that separates the different
columns.NullPointerException
- When the supplied columnSeparator is null.public static String stripSurroundingQuotes(String column)
column
- The column to strip the optional surrounding quotes from.public static String objectToCsvRow(Object object, List<Method> getters, Formatter formatter, Character columnSeparator)
object
- The object to convert to a single row of csv data.getters
- The getters to execute on the supplied object.
formatter
- The formatter to format the different columns.columnSeparator
- The separator that separates the different
columns.NullPointerException
- When either the supplied getters or
columnSeparator is null.public static String csvColumnToString(Object column, Formatter formatter)
column
- The column to create a String representation of.formatter
- The formatter to format the supplied column or null, to
not use a formatter.Copyright © 2008–2018. All rights reserved.