StringTableParser
Abstract class to extend AbstractTableParser but with Input = String. This is the normal situation where a file is a sequence of Strings, each representing one line.
Type parameters
- Table
-
the table type.
Attributes
- Graph
-
- Supertypes
-
class AbstractTableParser[Table]trait TableParser[Table]trait TableBuilder[Table]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class HeadedCSVTableParser[T]class HeadedStringTableParser[X]class PlainTextHeadedStringTableParser[X]class RawTableParserShow all
Members list
Type members
Types
The input type, typically String or Strings.
The input type, typically String or Strings.
Attributes
Inherited and Abstract types
The row type.
Value members
Concrete methods
Method to parse a Try[Source] character-by-character. NOTE the underlying source of sy will be closed after parsing has been completed.
Method to parse a Try[Source] character-by-character. NOTE the underlying source of sy will be closed after parsing has been completed.
Value parameters
- sy
-
a
Try[Source].
Attributes
- Returns
-
a
Try[Table].
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].
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].
Value parameters
- n
-
the number of rows to drop (length of the header)--defaults to 1.
- xs
-
the sequence of Inputs, one for each row
Attributes
- Returns
-
a Try[Table].
- Definition Classes
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.
Value parameters
- header
-
the
Headerobject that describes the expected structure of the table (e.g., column names). - ws
-
an iterator over the input strings, where each string represents a row in the table.
Attributes
- Returns
-
a
Tryof the parsedTableobject. On success, it contains the resulting table; on failure, it contains the parsing error.
Method to parse the input into a Table of the selected rows (see rows). As in parse, if this parser isn't forgiving, a row which can't be parsed makes the result a Failure.
Method to parse the input into a Table of the selected rows (see rows). As in parse, if this parser isn't forgiving, a row which can't be parsed makes the result a Failure.
Value parameters
- n
-
the number of header lines (defaults to headerRowsToRead).
- selection
-
the rows to select (RFC 7111: see CsvFragment).
- xs
-
the lines of the input.
Attributes
- Returns
-
a Try[Table].
Method to parse the input lazily, as a stream of rows rather than a Table (see, e.g., IOTable.stream). The header is read now (from the first n lines, unless this parser has a fixed header); each row is parsed only when it is pulled from the iterator. As in parse, the predicate selects the rows; and, if this parser is forgiving, a row which can't be parsed is logged and left out. Otherwise, it is a Failure in the iterator.
Method to parse the input lazily, as a stream of rows rather than a Table (see, e.g., IOTable.stream). The header is read now (from the first n lines, unless this parser has a fixed header); each row is parsed only when it is pulled from the iterator. As in parse, the predicate selects the rows; and, if this parser is forgiving, a row which can't be parsed is logged and left out. Otherwise, it is a Failure in the iterator.
The selection (of RFC 7111 rows: see CsvFragment) applies before the predicate, since its row numbers are those of the input.
Value parameters
- n
-
the number of header lines (defaults to headerRowsToRead).
- selection
-
the rows to select (by default, all of them).
- xs
-
the lines of the input.
Attributes
- Returns
-
a Try of the header and an Iterator of the rows (each a Try).
Inherited methods
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.
Value parameters
- ev
-
an implicit evidence parameter ensuring the input type adheres to the
Joinabletype class, which defines how input elements can be combined or validated during processing. - f
-
a transformation function that maps the
Headerto a function capable of transforming a tuple of input and its index into aTry[Row]. This function encapsulates row processing logic and error handling for each input element. - header
-
the
Headercontaining column metadata to guide the transformation process. - ts
-
an iterator of inputs to be parsed into rows.
Attributes
- Returns
-
a
Trycontaining aTableif the parsing is successful, or an error in case of failure. - Inherited from:
- AbstractTableParser
Inherited and Abstract methods
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.
Value parameters
- header
-
a Header object representing the table's column headers.
- rows
-
an iterator of Row objects representing the data rows.
Attributes
- Returns
-
the constructed Table based on the input rows and header.
- Inherited from:
- TableBuilder
Inherited fields
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.
Attributes
- Inherited from:
- TableBuilder
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.
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.
Attributes
- Inherited from:
- TableParser
Predicate to filter rows. Defaults to including all rows.
Inherited and Abstract fields
Method to define a row parser.
Method to define a row parser.
Attributes
- Returns
-
a RowParser[Row, Input].
- Inherited from:
- TableParser