Class CsvLine

java.lang.Object
be.yildizgames.common.csv.CsvLine

public class CsvLine
extends Object
Represent a line in a CSV document. Immutable class.
Author:
Grégory Van den Borre
  • Method Details

    • toLine

      public static CsvLine toLine​(String separator, Object... values)
      Create a new line from entries and a separator.
      Parameters:
      separator - Separator to set between the entries (cannot be null).
      values - List of entries to set (Cannot be null).
      Returns:
      The created line (never null).
      Throws:
      NullPointerException - If any parameter is null.
    • toLine

      public static CsvLine toLine​(String raw, String separator)
    • addToFile

      @API(status=STABLE) public final void addToFile​(Path file)
      Append this line to a file.
      Parameters:
      file - File to use (cannot be null).
      Throws:
      NullPointerException - If any parameter is null.
    • getHead

      @API(status=STABLE) public final String getHead()
      Provide the csv line head.
      Returns:
      The head (never null).
    • getRaw

      @API(status=INTERNAL) public final String getRaw()
      Provide the csv raw line.
      Returns:
      The raw line (never null).
    • getEntries

      @API(status=STABLE) public final List<String> getEntries()
      Provide the csv line head.
      Returns:
      The head (never null, immutable collection).