Class CsvFormat.Builder
java.lang.Object
de.xima.fc.logic.text.csv.CsvFormat.Builder
- Enclosing class:
CsvFormat
- Since:
- 8.2.0
-
Method Summary
Modifier and TypeMethodDescriptionallowDoubleQuoteEscape(boolean allowDoubleQuoteEscape) Whether to allow double quote escape.build()Builds theCsvFormatinstance.cellFilter(Predicate<String> cellFilter) Sets the cell filter that is applied to each cell.cellNormalizer(UnaryOperator<String> cellNormalizer) Sets the cell normalizer that is applied to each cell.delimiter(int delimiter) Sets the character used to delimit cells.Sets the character used to delimit cells.escape(int escape) Sets the character used to escape special characters in a cell.Sets the character used to escape special characters in a cell.ignoreBlankCells(boolean filterBlankCells) Sets up thecellFilterto filter out blank cells.ignoreEmptyCells(boolean filterEmptyCells) Sets up thecellFilterto filter out empty cells.Sets the characters that are treated as newlines.newlines(Collection<String> newlines) Sets the characters that are treated as newlines.quote(int quote) Sets thequoteOpenandquoteClosecharacters to the same value.Sets thequoteOpenandquoteClosecharacters to the same value.quoteClose(int quoteClose) Sets the character used to end a quoted cell.quoteClose(String quoteClose) Sets the character used to end a quoted cell.quoteOpen(int quoteOpen) Sets the character used to start a quoted cell.Sets the character used to start a quoted cell.Sets the row filter that is applied to each row after it was split into cells.rowMutator(Consumer<List<String>> rowMutator) Sets the row normalizer that is applied to each row after it was split into cells.rowNormalizer(UnaryOperator<List<String>> rowNormalizer) Sets the row normalizer that is applied to each row after it was split into cells.treatLineBreaksAsDelimiter(boolean treatLineBreaksAsDelimiter) When set totrue, line breaks will be treated as cell delimiters.trimCells(boolean trimCells) Sets up thecellNormalizerto trim cells, i.e. remove leading and trailing whitespace.
-
Method Details
-
allowDoubleQuoteEscape
Whether to allow double quote escape. If set totrue, a quote character can be escaped by repeating it.- Parameters:
allowDoubleQuoteEscape- Whether to allow double quote escape.- Returns:
- This builder for chaining method calls.
-
build
-
cellFilter
Sets the cell filter that is applied to each cell. The filter is applied after the cell normalizer and may remove cells from the result.- Parameters:
cellFilter- The cell filter.- Returns:
- This builder for chaining method calls.
-
cellNormalizer
Sets the cell normalizer that is applied to each cell. The normalizer is applied before the cell filter and may transform the cell into a different cell.- Parameters:
cellNormalizer- The cell normalizer.- Returns:
- This builder for chaining method calls.
-
delimiter
Sets the character used to delimit cells.- Parameters:
delimiter- The delimiter character.- Returns:
- This builder for chaining method calls.
-
delimiter
Sets the character used to delimit cells.- Parameters:
delimiter- The delimiter character.- Returns:
- This builder for chaining method calls.
-
escape
Sets the character used to escape special characters in a cell.- Parameters:
escape- The escape character.- Returns:
- This builder for chaining method calls.
-
escape
Sets the character used to escape special characters in a cell.- Parameters:
escape- The escape character.- Returns:
- This builder for chaining method calls.
-
ignoreBlankCells
Sets up thecellFilterto filter out blank cells.- Parameters:
filterBlankCells- Iftrue, blank cells will be filtered out.- Returns:
- This builder for chaining method calls.
-
ignoreEmptyCells
Sets up thecellFilterto filter out empty cells.- Parameters:
filterEmptyCells- Iftrue, empty cells will be filtered out.- Returns:
- This builder for chaining method calls.
-
newlines
Sets the characters that are treated as newlines.- Parameters:
newlines- The newline characters.- Returns:
- This builder for chaining method calls.
-
newlines
Sets the characters that are treated as newlines.- Parameters:
newlines- The newline characters.- Returns:
- This builder for chaining method calls.
-
quote
Sets thequoteOpenandquoteClosecharacters to the same value.- Parameters:
quote- The quote character.- Returns:
- This builder for chaining method calls.
-
quote
Sets thequoteOpenandquoteClosecharacters to the same value.- Parameters:
quote- The quote character.- Returns:
- This builder for chaining method calls.
-
quoteClose
Sets the character used to end a quoted cell.- Parameters:
quoteClose- The quote character.- Returns:
- This builder for chaining method calls.
-
quoteClose
Sets the character used to end a quoted cell.- Parameters:
quoteClose- The quote character.- Returns:
- This builder for chaining method calls.
-
quoteOpen
Sets the character used to start a quoted cell.- Parameters:
quoteOpen- The quote character.- Returns:
- This builder for chaining method calls.
-
quoteOpen
Sets the character used to start a quoted cell.- Parameters:
quoteOpen- The quote character.- Returns:
- This builder for chaining method calls.
-
rowFilter
Sets the row filter that is applied to each row after it was split into cells. The filter is applied after the cell normalizer and may remove rows from the result.- Parameters:
rowFilter- The row filter.- Returns:
- This builder for chaining method calls.
-
rowMutator
Sets the row normalizer that is applied to each row after it was split into cells. The normalizer is applied before the row filter and may transform the row into a different row.- Parameters:
rowMutator- The row normalizer.- Returns:
- This builder for chaining method calls.
-
rowNormalizer
Sets the row normalizer that is applied to each row after it was split into cells. The normalizer is applied before the row filter and may transform the row into a different row.- Parameters:
rowNormalizer- The row normalizer.- Returns:
- This builder for chaining method calls.
-
treatLineBreaksAsDelimiter
When set totrue, line breaks will be treated as cell delimiters. Useful when splitting a single row of characters separated values. Not recommended for splitting multiple rows (as it will result in a single row with all cells).- Parameters:
treatLineBreaksAsDelimiter- Whether to treat line breaks as delimiters.- Returns:
- This builder for chaining method calls.
-
trimCells
Sets up thecellNormalizerto trim cells, i.e. remove leading and trailing whitespace.- Parameters:
trimCells- Iftrue, cells will be trimmed.- Returns:
- This builder for chaining method calls.
-