Package com.gengoai.string
Class CSVFormatter
- java.lang.Object
-
- com.gengoai.string.CSVFormatter
-
- All Implemented Interfaces:
Serializable
public class CSVFormatter extends Object implements Serializable
Formats a series of items in Delimited Separated Value format.
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CSVFormatter(CSV csvFormat)
Instantiates a new CSV formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Iterable<?> iterable)
Formats the items in anIterable
.String
format(Object... array)
Formats the items in an Array.String
format(Iterator<?> itr)
Formats the items in anIterator
.String
format(Map<?,?> map)
Formats the items in aMap
.String
format(Map<?,?> map, char keyValueSeparator)
Formats the items in aMap
.String
format(Stream<?> stream)
Formats the items in the givenStream
.
-
-
-
Constructor Detail
-
CSVFormatter
public CSVFormatter(CSV csvFormat)
Instantiates a new CSV formatter.- Parameters:
csvFormat
- the csv format
-
-
Method Detail
-
format
public String format(Stream<?> stream)
Formats the items in the givenStream
.- Parameters:
stream
- the stream- Returns:
- the string
-
format
public String format(Iterator<?> itr)
Formats the items in anIterator
.- Parameters:
itr
- The iterator to format- Returns:
- A String representing the single DSV formatted row
-
format
public String format(Map<?,?> map)
Formats the items in aMap
. Keys and values are separated using:
.- Parameters:
map
- The Map to format- Returns:
- A String representing the single DSV formatted row of Map entries
-
format
public String format(Map<?,?> map, char keyValueSeparator)
Formats the items in aMap
.- Parameters:
map
- The Map to formatkeyValueSeparator
- the character to use to separate keys and values- Returns:
- A String representing the single DSV formatted row of Map entries
-
format
public String format(Iterable<?> iterable)
Formats the items in anIterable
.- Parameters:
iterable
- the iterable- Returns:
- the string
-
-