abstract class HeadedStringTableParser[X] extends StringTableParser[Table[X]] with CopyableTableParser[X, String, Table[X]]

Abstract class to define a StringTableParser that assumes a header to be found in the input file. There are two subclasses: PlainTextHeadedStringTableParser and EncryptedHeadedStringTableParser This class attempts to provide as much built-in functionality as possible.

This class assumes that the names of the columns are in the first line. This class implements builder with a HeadedTable object. This class uses StandardRowParser of its rowParser.

NOTE that this class and HeadedCSVTableParser are extremely similar (maybe identical) CONSIDER merging with HeadedCSVTableParser

X

the underlying row type for which there must be evidence of a CellParser and ClassTag.

See also

HeadedStringTableParser#create

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HeadedStringTableParser
  2. CopyableTableParser
  3. StringTableParser
  4. AbstractTableParser
  5. TableParser
  6. TableBuilder
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new HeadedStringTableParser(maybeFixedHeader: Option[Header] = None, forgiving: Boolean = false, headerRowsToRead: Int = 1)(implicit arg0: CellParser[X], arg1: ClassTag[X])

    maybeFixedHeader

    None => requires that the data source has a header row. Some(h) => specifies that the header is to be taken from h. Defaults to None. NOTE: that the simplest is to specify the header directly from the type X.

    forgiving

    if true, exceptions when parsing individual rows will be logged then ignored. if false, any exception will terminate the parsing. Defaults to false.

    headerRowsToRead

    the number of header rows expected in the input file defaults to 1.

Type Members

  1. type Input = String

    The input type, typically String or Strings.

    The input type, typically String or Strings.

    Definition Classes
    StringTableParser → TableParser
  2. type Row = X

    The row type.

    The row type.

    Definition Classes
    HeadedStringTableParser → TableBuilder

Abstract Value Members

  1. abstract def setForgiving(forgiving: Boolean): TableParser[Table[X]]

    Configures the parser to operate in a "forgiving" mode, where errors encountered during the parsing of individual rows are logged but do not cause the parsing process to fail.

    Configures the parser to operate in a "forgiving" mode, where errors encountered during the parsing of individual rows are logged but do not cause the parsing process to fail. When set to true, the parser will attempt to continue parsing despite encountering errors in the input. When set to false, errors will cause the parsing process to terminate.

    forgiving

    a boolean value indicating whether forgiving mode should be enabled. true enables forgiving mode, allowing parsing to continue on errors. false disables forgiving mode, causing failures on errors.

    returns

    an instance of TableParser[Table] configured with the specified forgiving behavior.

    Definition Classes
    CopyableTableParser
  2. abstract def setHeader(header: Header): TableParser[Table[X]]

    Sets a fixed header for the table parser.

    Sets a fixed header for the table parser. This method allows the configuration of the parser to use the specified header, instead of deriving it from the data during parsing.

    header

    the Header instance representing the fixed header for the table parser, containing column names and optional additional header lines.

    returns

    a new TableParser[Table] instance configured with the specified header.

    Definition Classes
    CopyableTableParser
  3. abstract def setMultiline(multiline: Boolean): TableParser[Table[X]]

    Configures the parser to allow or disallow quoted strings to span across multiple lines.

    Configures the parser to allow or disallow quoted strings to span across multiple lines.

    When multiline is set to true, the parser permits quoted strings in the input to extend beyond a single line. If set to false, quoted strings are constrained to stay within one line.

    multiline

    a boolean flag indicating whether multiline parsing of quoted strings is enabled (true) or disabled (false).

    returns

    a new TableParser[Table] instance configured with the updated multiline setting.

    Definition Classes
    CopyableTableParser
  4. abstract def setPredicate(predicate: (Try[X]) => Boolean): TableParser[Table[X]]

    Sets a predicate function that determines whether a parsed Row should be included in the final Table.

    Sets a predicate function that determines whether a parsed Row should be included in the final Table. The predicate is applied to each parsed Row wrapped in a Try to allow filtering based on success or failure.

    predicate

    a function of type Try[Row] => Boolean that accepts a Try of a Row and returns true if the row should be included in the table, or false otherwise.

    returns

    a new instance of TableParser[Table] with the specified predicate applied.

    Definition Classes
    CopyableTableParser
  5. abstract def setRowParser(rowParser: RowParser[X, String]): TableParser[Table[X]]

    Sets the row parser to be used for parsing rows in the table.

    Sets the row parser to be used for parsing rows in the table.

    The row parser provides the logic for converting raw input data of type Input into rows of type Row. This method allows you to configure the table parser with a custom row parser, enabling flexibility in interpreting the rows according to specific requirements.

    rowParser

    the RowParser instance to use for parsing rows. The RowParser defines how each input (of type Input) is transformed into a row (of type Row), potentially using a Header for additional context.

    returns

    a new TableParser instance configured with the specified row parser.

    Definition Classes
    CopyableTableParser

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def builder(rows: Iterator[X], header: Header): Table[Row]

    Method to construct a Table based on the given iterator of rows and the given header.

    Method to construct a Table based on the given iterator of rows and the given header.

    rows

    an iterator of Row objects representing the data rows.

    header

    a Header object representing the table's column headers.

    returns

    the constructed Table based on the input rows and header.

    Attributes
    protected
    Definition Classes
    HeadedStringTableParser → TableBuilder
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def doParseRows(ts: Iterator[Input], header: Header, f: ((Input, Int)) => Try[Row])(implicit ev: Joinable[Input]): Try[Table[X]]

    Parses rows of input data into a table representation.

    Parses rows of input data into a table representation.

    This method utilizes an IndexedInputToRowsAggregator to transform an iterator of inputs into rows using the provided header and transformation function. It processes the input, materializes the resulting rows into a list, and constructs a table representation from the processed rows and header.

    ts

    an iterator of inputs to be parsed into rows.

    header

    the Header containing column metadata to guide the transformation process.

    f

    a transformation function that maps the Header to a function capable of transforming a tuple of input and its index into a Try[Row]. This function encapsulates row processing logic and error handling for each input element.

    ev

    an implicit evidence parameter ensuring the input type adheres to the Joinable type class, which defines how input elements can be combined or validated during processing.

    returns

    a Try containing a Table if the parsing is successful, or an error in case of failure.

    Definition Classes
    AbstractTableParser
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. val forgiving: Boolean

    If true, individual row failures are logged but do not cause the overall parse to fail.

    If true, individual row failures are logged but do not cause the overall parse to fail.

    Definition Classes
    HeadedStringTableParser → TableBuilder
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. val headerRowsToRead: Int

    This indicates the number of header rows which must be read from the input.

    This indicates the number of header rows which must be read from the input. The value is usually 1 but some types of CSV file have more than one header line. If maybeHeader exists, then this number is ignored.

    CONSIDER if this is really ignored when maybeHeader is defined, then we should eliminate such places where this value has an override of 0.

    Definition Classes
    HeadedStringTableParser → TableParser
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. val maybeHeader: Option[Header]

    This variable determines if there is a programmed, i.e., fixed, header for the parser.

    This variable determines if there is a programmed, i.e., fixed, header for the parser. If its value is None, it signifies that we must look to the first line(s) of data for an appropriate header.

    Attributes
    protected
    Definition Classes
    TableParser
  16. val multiline: Boolean

    Value to determine whether it is acceptable to have a quoted string span more than one line.

    Value to determine whether it is acceptable to have a quoted string span more than one line.

    returns

    true if quoted strings may span more than one line.

    Attributes
    protected
    Definition Classes
    TableParser
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def parse(xs: Iterator[String], n: Int = headerRowsToRead): Try[Table[X]]

    Method to parse a table based on a sequence of Inputs.

    Method to parse a table based on a sequence of Inputs. NOTE: this is required so that we can invoke this method with an Iterator[String].

    xs

    the sequence of Inputs, one for each row

    n

    the number of rows to drop (length of the header)--defaults to 1.

    returns

    a Try[Table].

    Definition Classes
    StringTableParser → AbstractTableParser → TableParser
  21. def parseRows(ws: Iterator[String], header: Header): Try[Table[X]]

    Parses rows from an iterator of input strings (ws) using the provided header and row parsing logic.

    Parses rows from an iterator of input strings (ws) using the provided header and row parsing logic.

    This method utilizes the doParseRows function to process each row in the input iterator, applying the provided rowParser.parse function to convert input strings into logical rows, while using the header to guide parsing and interpretation of the input.

    ws

    an iterator over the input strings, where each string represents a row in the table.

    header

    the Header object that describes the expected structure of the table (e.g., column names).

    returns

    a Try of the parsed Table object. On success, it contains the resulting table; on failure, it contains the parsing error.

    Definition Classes
    StringTableParser → AbstractTableParser
  22. val predicate: (Try[Row]) => Boolean

    Predicate to filter rows.

    Predicate to filter rows. Defaults to including all rows.

    Attributes
    protected
    Definition Classes
    TableBuilder
  23. val rowParser: RowParser[X, String]

    Method to define a row parser.

    Method to define a row parser.

    returns

    a RowParser[Row, Input].

    Definition Classes
    HeadedStringTableParser → TableParser
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from CopyableTableParser[X, String, Table[X]]

Inherited from StringTableParser[Table[X]]

Inherited from AbstractTableParser[Table[X]]

Inherited from TableParser[Table[X]]

Inherited from TableBuilder[Table[X]]

Inherited from AnyRef

Inherited from Any

Ungrouped