Package io.deephaven.importers.csv
Class CsvImporterHelperGeneral
java.lang.Object
io.deephaven.importers.csv.CsvImporterHelperGeneral
- All Implemented Interfaces:
CsvImporterHelper,Closeable,AutoCloseable
Implementation of
CsvImporterHelper that handles general CSV import scenarios.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the streamintReturns the buffer size that will be used when creating a FooterSkipBufferedReaderGet the list of column names from a CSV file; only call after it's been initialized with a streamlongprocessImport(@NotNull Logger log, @NotNull ImportTableWriterFactory writerFactory, @NotNull Map<String, ImporterColumnDefinition> icdMap, @NotNull Map<String, String> importProperties, @NotNull String arrayDelimiter, @Nullable String constantColumnValue, @NotNull AtomicInteger errorCount, int maxError, boolean strict) Process the source file or stream and persist to disk as a TablevoidsetBufferSize(int bufferSize) Sets the buffer size to use for a FooterSkipBufferedReadervoidValidate the import.
-
Method Details
-
getBufferSize
public int getBufferSize()Description copied from interface:CsvImporterHelperReturns the buffer size that will be used when creating a FooterSkipBufferedReader- Specified by:
getBufferSizein interfaceCsvImporterHelper- Returns:
- int size of the buffer in characters
-
setBufferSize
public void setBufferSize(int bufferSize) Description copied from interface:CsvImporterHelperSets the buffer size to use for a FooterSkipBufferedReader- Specified by:
setBufferSizein interfaceCsvImporterHelper- Parameters:
bufferSize- size of the buffer in characters
-
getColumnNamesFromStream
Description copied from interface:CsvImporterHelperGet the list of column names from a CSV file; only call after it's been initialized with a stream- Specified by:
getColumnNamesFromStreamin interfaceCsvImporterHelper- Returns:
- the List of column names
-
processImport
public long processImport(@NotNull @NotNull Logger log, @NotNull @NotNull ImportTableWriterFactory writerFactory, @NotNull @NotNull Map<String, ImporterColumnDefinition> icdMap, @NotNull @NotNull Map<String, throws IOExceptionString> importProperties, @NotNull @NotNull String arrayDelimiter, @Nullable @Nullable String constantColumnValue, @NotNull @NotNull AtomicInteger errorCount, int maxError, boolean strict) Description copied from interface:CsvImporterHelperProcess the source file or stream and persist to disk as a Table- Specified by:
processImportin interfaceCsvImporterHelper- Parameters:
log- The passed-down loggerwriterFactory- The passed down ImportTableWriterFactoryicdMap- The column name to ImporterColumnDefinition mapimportProperties- Provides basic import attributesarrayDelimiter- Delimiter used to parse array data typesconstantColumnValue- A String to materialize as the source column when an ImportColumn is defined with a sourceType of CONSTANT (aka ImporterColumnDefinition$IrisImportConstant). Can be null.errorCount- Holds a record of parse errorsmaxError- Maximum number of field conversion failures allowedstrict- Whether to fail if a field fails conversion- Returns:
- The number of rows processed
- Throws:
IOException- from the import
-
close
Description copied from interface:CsvImporterHelperClose the stream- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCsvImporterHelper- Throws:
IOException- if an error occurs
-
validateImport
Description copied from interface:CsvImporterHelperValidate the import.- Specified by:
validateImportin interfaceCsvImporterHelper- Throws:
ImportException- if the import failed
-