Class DirectoryCSVLoader


  • public class DirectoryCSVLoader
    extends Object
    Helper to load data from a CSV file.

    The actual consumer of rows is a parameter passed by the caller.

    Since:
    8.4
    • Field Detail

      • CSV_NULL_MARKER

        public static final String CSV_NULL_MARKER
        The special CSV value ("__NULL__") used to denote that a null should be used for a value.
        See Also:
        Constant Field Values
    • Method Detail

      • loadData

        public static void loadData​(String dataFileName,
                                    char delimiter,
                                    Schema schema,
                                    Consumer<Map<String,​Object>> loader)
        Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.
        Parameters:
        dataFileName - the file name containing CSV data
        delimiter - the CSV column separator
        schema - the data schema
        loader - the actual consumer of loaded rows
        Since:
        8.4
        See Also:
        loadData(Blob, char, Schema, Consumer)
      • createBlob

        protected static Blob createBlob​(String dataFileName)
      • loadData

        public static void loadData​(Blob dataBlob,
                                    char delimiter,
                                    Schema schema,
                                    Consumer<Map<String,​Object>> loader)
        Loads the CSV data file based on the provided schema, and creates the corresponding entries using the provided loader.
        Parameters:
        dataBlob - the blob containing CSV data
        delimiter - the CSV column separator
        schema - the data schema
        loader - the actual consumer of loaded rows
        Since:
        11.1