Class RowSourceCsv.Builder
- Enclosing class:
RowSourceCsv
-
Method Summary
Modifier and TypeMethodDescriptionbuild()withAutoDetectEncoding(boolean autoDetectEncoding) withCharset(Charset charset) withColumnRename(ColumnName original, ColumnName newName) withColumnRenames(Map<ColumnName, ColumnName> renames) withColumnType(ColumnName columnName, Column.Type columnType) Specifies a source-side column type for CSV reading.withColumnTypes(Map<ColumnName, Column.Type> columnTypes) Specifies a source-side column type for CSV reading.withFixedWidths(int[] fixedWidths) withHeaderStrategy(HeaderStrategy headerStrategy) withQuote(char quote) withRowFilter(RowFilter rowFilter) withSelectedColumn(ColumnName columnName) withSelectedColumns(ColumnName... columnNames) withSeparator(char separator) withStreamSource(StreamSource streamSource) withStripping(boolean stripping)
-
Method Details
-
withStreamSource
-
withHeaderStrategy
-
withSelectedColumn
-
withSelectedColumns
-
withColumnRename
-
withColumnRenames
-
withRowFilter
-
withSeparator
-
withStripping
-
withQuote
-
withFixedWidths
-
withCharset
-
withAutoDetectEncoding
-
withColumnType
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 aStringcolumn 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 namecolumnType- the source-side column type- Returns:
- this builder
-
withColumnTypes
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, anddouble- custom enum-like object types with fast
CharSequence-based parsers- Parameters:
columnTypes- source-side column types keyed by column name- Returns:
- this builder
-
build
-