Class RowSourceCsv.Builder

java.lang.Object
app.babylon.table.io.RowSourceCsv.Builder
Enclosing class:
RowSourceCsv

public static final class RowSourceCsv.Builder extends Object
  • Method Details

    • withStreamSource

      public RowSourceCsv.Builder withStreamSource(StreamSource streamSource)
    • withHeaderStrategy

      public RowSourceCsv.Builder withHeaderStrategy(HeaderStrategy headerStrategy)
    • withSelectedColumn

      public RowSourceCsv.Builder withSelectedColumn(ColumnName columnName)
    • withSelectedColumns

      public RowSourceCsv.Builder withSelectedColumns(ColumnName... columnNames)
    • withColumnRename

      public RowSourceCsv.Builder withColumnRename(ColumnName original, ColumnName newName)
    • withColumnRenames

      public RowSourceCsv.Builder withColumnRenames(Map<ColumnName,ColumnName> renames)
    • withRowFilter

      public RowSourceCsv.Builder withRowFilter(RowFilter rowFilter)
    • withSeparator

      public RowSourceCsv.Builder withSeparator(char separator)
    • withStripping

      public RowSourceCsv.Builder withStripping(boolean stripping)
    • withQuote

      public RowSourceCsv.Builder withQuote(char quote)
    • withFixedWidths

      public RowSourceCsv.Builder withFixedWidths(int[] fixedWidths)
    • withCharset

      public RowSourceCsv.Builder withCharset(Charset charset)
    • withAutoDetectEncoding

      public RowSourceCsv.Builder withAutoDetectEncoding(boolean autoDetectEncoding)
    • withColumnType

      public RowSourceCsv.Builder withColumnType(ColumnName columnName, Column.Type columnType)
      Specifies a source-side column type for CSV reading.

      The supplied type is exposed through the resulting RowCursorCsv.columns() metadata and can therefore select the low-level builder used during row consumption. This is the preferred place to specify a type when the goal is to parse row slices directly into the final builder rather than first building a String column and converting it later.

      For ordinary categorical text this is usually not needed. In that common case it is often better to keep the source as STRING, let the row consumer build the string dictionary naturally, and only specify a source-side type when the direct parser has a real advantage.

      Parameters:
      columnName - the source column name
      columnType - the source-side column type
      Returns:
      this builder
    • withColumnTypes

      public RowSourceCsv.Builder withColumnTypes(Map<ColumnName,Column.Type> columnTypes)
      Specifies a source-side column type for CSV reading.

      This is stronger than a purely post-read typing hint. The type supplied here becomes part of the RowCursorCsv.columns() metadata and can therefore influence which builder the row consumer creates before rows are read.

      For categorical text columns, this is best reserved for cases where the direct parser is meaningfully better than first creating the string dictionary.

      Use this when the source text can be parsed directly into the desired builder and you want to avoid an intermediate string column in memory, for example:

      - primitive numeric columns such as int, long, and double

      - custom enum-like object types with fast CharSequence-based parsers

      Parameters:
      columnTypes - source-side column types keyed by column name
      Returns:
      this builder
    • build

      public RowSourceCsv build()