Interface RowInstructions

All Known Implementing Classes:
RowInstructionsImpl

public interface RowInstructions
These instructions are used to power the RowReader. Note that the instructions are also used internally if annotations are used.
  • Method Summary

    Modifier and Type
    Method
    Description
    char[]
    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
    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.
    boolean
    Checks to see if a header must be used for the table.
    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 enabled)
    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.
  • Method Details

    • setUseHeader

      RowInstructions setUseHeader(boolean useHeader)
      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 whenever CsvFile.useHeader() is used. The default value for this setting is true.
      Parameters:
      useHeader - true if the header is interpreted and used
      Returns:
      convenience for chaining
    • isUseHeader

      boolean isUseHeader()
      Checks to see if a header must be used for the table.
      Returns:
      true if a header must be used
    • setStartRow

      RowInstructions setStartRow(int startRow)
      Sets the start row of the CSV file. If setUseHeader(boolean) == true, this will be the header row and the next ones are all content rows. This method is called whenever CsvFile.startRow() is used. The default value for this setting is 0.
      Parameters:
      startRow - the first row to start reading, including the header row
      Returns:
      convenience for chaining
    • getEscape

      char getEscape()
      Returns the escape character to use for writing a cell.
      Returns:
      the escape character
    • setEscape

      RowInstructions setEscape(char symbol)
      Sets the character that will be interpreted as an escape symbol while within a quoted field. This method is called whenever CsvFile.escape() is used. The default value for this setting is a double quote (") symbol.
      Parameters:
      symbol - the symbol to use for escaping characters within a quoted field
      Returns:
      convenience for chaining
    • getQuote

      char getQuote()
      Returns the character that will be used when writing quote characters.
      Returns:
      character used to represent quote characters
    • setQuote

      RowInstructions 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. This method is called whenever CsvFile.quote() is used. The default value for this setting is a double quote (") symbol.
      Parameters:
      symbol - the symbol to use for indicating start/end of a quoted field
      Returns:
      convenience for chaining
    • setQuotingEnabled

      RowInstructions setQuotingEnabled(boolean enabled)
      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.
      Parameters:
      enabled - whether or not to put quotes around fields
      Returns:
      convenience for chaining
    • getQuotingEnabled

      boolean getQuotingEnabled()
      Returns whether or not quotes around fields are enabled.
      Returns:
      true if quotes are enabled
    • getSeparator

      char getSeparator()
      Gets the character that will be used when writing separators.
      Returns:
      character used to represent separator characters
    • setSeparator

      RowInstructions setSeparator(char symbol)
      Sets the character that will be interpreted as a separator between cells. This method is called whenever CsvFile.separator() is used. The default value for this setting is a semi-colon (;).
      Parameters:
      symbol - the symbol to use as a separator between cells
      Returns:
      convenience for chaining
    • setComment

      RowInstructions setComment(char symbol)
      Sets the character that will be interpreted as a comment field on the first position of a row. This method is called whenever CsvFile.comment() is used. The default value for this setting is a hashtag (#).
      Parameters:
      symbol - the symbol to use as the 0-position comment marker
      Returns:
      convenience for chaining
    • getEndOfLine

      char[] getEndOfLine()
      Gets the characters that will be used when writing End-of-line separators.
      Returns:
      the EOL characters
    • setEndOfLine

      RowInstructions setEndOfLine(char[] symbols)
      Sets the characters (plural) that will be interpreted as end-of-line markers (unless within a quoted field). This method is called whenever CsvFile.endOfLine() is used. The default values for this setting are \r and \n
      Parameters:
      symbols - the symbol to interpret as end-of-line markers (unless within a quoted field)
      Returns:
      convenience for chaining
    • skipEmptyLines

      RowInstructions skipEmptyLines(boolean skip)
      Determines whether empty lines must be skipped or treated as single-column rows. This method is called whenever CsvFile.skipEmptyLines() is used. The default value for this setting is to skip the empty lines.
      Parameters:
      skip - true to skip empty lines, false to treat as single-column rows
      Returns:
      convenience for chaining
    • skipCommentLines

      RowInstructions skipCommentLines(boolean skip)
      Determines whether comment lines must be skipped. This method is called whenever CsvFile.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.
      Parameters:
      skip - true to skip comment lines, identified as starting with a comment marker
      Returns:
      convenience for chaining