java.lang.Object
org.csveed.row.RowInstructionsImpl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchar[]
Gets the characters that will be used when writing End-of-line separators.char
Returns the escape character to use for writing a cell.char
getQuote()
Returns the character that will be used when writing quote characters.boolean
Returns whether or not quotes around fields are enabled.char
Gets the character that will be used when writing separators.Gets the symbol mapping.boolean
Checks if is skip empty lines.boolean
Checks to see if a header must be used for the table.void
Log settings.setComment
(char symbol) Sets the character that will be interpreted as a comment field on the first position of a row.setEndOfLine
(char[] symbols) Sets the characters (plural) that will be interpreted as end-of-line markers (unless within a quoted field).setEscape
(char symbol) Sets the character that will be interpreted as an escape symbol while within a quoted field.setQuote
(char symbol) Sets the character that will be interpreted as a quote symbol, signifying either the start or the end of a quoted field.setQuotingEnabled
(boolean quoteFields) Sets whether or not quotes are written around the field values.setSeparator
(char symbol) Sets the character that will be interpreted as a separator between cells.setStartRow
(int startRow) Sets the start row of the CSV file.setUseHeader
(boolean useHeader) Makes sure that the first readable line is interpreted as the header line.skipCommentLines
(boolean skip) Determines whether comment lines must be skipped.skipEmptyLines
(boolean skip) Determines whether empty lines must be skipped or treated as single-column rows.
-
Constructor Details
-
RowInstructionsImpl
public RowInstructionsImpl()
-
-
Method Details
-
logSettings
public void logSettings()Log settings. -
getSymbolMapping
-
isSkipEmptyLines
public boolean isSkipEmptyLines()Checks if is skip empty lines.- Returns:
- true, if is skip empty lines
-
isUseHeader
public boolean isUseHeader()Description copied from interface:RowInstructions
Checks to see if a header must be used for the table.- Specified by:
isUseHeader
in interfaceRowInstructions
- Returns:
- true if a header must be used
-
setUseHeader
Description copied from interface:RowInstructions
Makes sure that the first readable line is interpreted as the header line. That line will not be read as content. This method is called wheneverCsvFile.useHeader()
is used. The default value for this setting is true.- Specified by:
setUseHeader
in interfaceRowInstructions
- Parameters:
useHeader
- true if the header is interpreted and used- Returns:
- convenience for chaining
-
setStartRow
Description copied from interface:RowInstructions
Sets the start row of the CSV file. IfRowInstructions.setUseHeader(boolean)
== true, this will be the header row and the next ones are all content rows. This method is called wheneverCsvFile.startRow()
is used. The default value for this setting is 0.- Specified by:
setStartRow
in interfaceRowInstructions
- Parameters:
startRow
- the first row to start reading, including the header row- Returns:
- convenience for chaining
-
getEscape
public char getEscape()Description copied from interface:RowInstructions
Returns the escape character to use for writing a cell.- Specified by:
getEscape
in interfaceRowInstructions
- Returns:
- the escape character
-
setEscape
Description copied from interface:RowInstructions
Sets the character that will be interpreted as an escape symbol while within a quoted field. This method is called wheneverCsvFile.escape()
is used. The default value for this setting is a double quote (") symbol.- Specified by:
setEscape
in interfaceRowInstructions
- Parameters:
symbol
- the symbol to use for escaping characters within a quoted field- Returns:
- convenience for chaining
-
getQuote
public char getQuote()Description copied from interface:RowInstructions
Returns the character that will be used when writing quote characters.- Specified by:
getQuote
in interfaceRowInstructions
- Returns:
- character used to represent quote characters
-
setQuotingEnabled
Description copied from interface:RowInstructions
Sets whether or not quotes are written around the field values. If enabled, the character set as the escape symbol will be disabled. If disabled, no quotes are written around the field values and the escape symbol is not escaped. This setting has no effect when reading CSV files, only when writing them.- Specified by:
setQuotingEnabled
in interfaceRowInstructions
- Parameters:
quoteFields
- whether or not to put quotes around fields- Returns:
- convenience for chaining
-
getQuotingEnabled
public boolean getQuotingEnabled()Description copied from interface:RowInstructions
Returns whether or not quotes around fields are enabled.- Specified by:
getQuotingEnabled
in interfaceRowInstructions
- Returns:
- true if quotes are enabled
-
setQuote
Description copied from interface:RowInstructions
Sets the character that will be interpreted as a quote symbol, signifying either the start or the end of a quoted field. This method is called wheneverCsvFile.quote()
is used. The default value for this setting is a double quote (") symbol.- Specified by:
setQuote
in interfaceRowInstructions
- Parameters:
symbol
- the symbol to use for indicating start/end of a quoted field- Returns:
- convenience for chaining
-
getSeparator
public char getSeparator()Description copied from interface:RowInstructions
Gets the character that will be used when writing separators.- Specified by:
getSeparator
in interfaceRowInstructions
- Returns:
- character used to represent separator characters
-
setSeparator
Description copied from interface:RowInstructions
Sets the character that will be interpreted as a separator between cells. This method is called wheneverCsvFile.separator()
is used. The default value for this setting is a semi-colon (;).- Specified by:
setSeparator
in interfaceRowInstructions
- Parameters:
symbol
- the symbol to use as a separator between cells- Returns:
- convenience for chaining
-
setComment
Description copied from interface:RowInstructions
Sets the character that will be interpreted as a comment field on the first position of a row. This method is called wheneverCsvFile.comment()
is used. The default value for this setting is a hashtag (#).- Specified by:
setComment
in interfaceRowInstructions
- Parameters:
symbol
- the symbol to use as the 0-position comment marker- Returns:
- convenience for chaining
-
getEndOfLine
public char[] getEndOfLine()Description copied from interface:RowInstructions
Gets the characters that will be used when writing End-of-line separators.- Specified by:
getEndOfLine
in interfaceRowInstructions
- Returns:
- the EOL characters
-
setEndOfLine
Description copied from interface:RowInstructions
Sets the characters (plural) that will be interpreted as end-of-line markers (unless within a quoted field). This method is called wheneverCsvFile.endOfLine()
is used. The default values for this setting are \r and \n- Specified by:
setEndOfLine
in interfaceRowInstructions
- Parameters:
symbols
- the symbol to interpret as end-of-line markers (unless within a quoted field)- Returns:
- convenience for chaining
-
skipEmptyLines
Description copied from interface:RowInstructions
Determines whether empty lines must be skipped or treated as single-column rows. This method is called wheneverCsvFile.skipEmptyLines()
is used. The default value for this setting is to skip the empty lines.- Specified by:
skipEmptyLines
in interfaceRowInstructions
- Parameters:
skip
- true to skip empty lines, false to treat as single-column rows- Returns:
- convenience for chaining
-
skipCommentLines
Description copied from interface:RowInstructions
Determines whether comment lines must be skipped. This method is called wheneverCsvFile.skipCommentLines()
is used. The default value for this setting is to skip comment lines. This method exists to guarantee that lines are not accidentally treated as comment lines.- Specified by:
skipCommentLines
in interfaceRowInstructions
- Parameters:
skip
- true to skip comment lines, identified as starting with a comment marker- Returns:
- convenience for chaining
-