Class CSVDriverFunction

  • All Implemented Interfaces:
    org.h2gis.api.DriverFunction

    public class CSVDriverFunction
    extends Object
    implements org.h2gis.api.DriverFunction
    Basic CSV importer and exporter
    Author:
    Erwan Bocher, Sylvain PALOMINOS (UBS 2019)
    • Field Detail

      • DESCRIPTION

        public static String DESCRIPTION
    • Constructor Detail

      • CSVDriverFunction

        public CSVDriverFunction()
    • Method Detail

      • getImportDriverType

        public org.h2gis.api.DriverFunction.IMPORT_DRIVER_TYPE getImportDriverType()
        Specified by:
        getImportDriverType in interface org.h2gis.api.DriverFunction
      • getImportFormats

        public String[] getImportFormats()
        Specified by:
        getImportFormats in interface org.h2gis.api.DriverFunction
      • getExportFormats

        public String[] getExportFormats()
        Specified by:
        getExportFormats in interface org.h2gis.api.DriverFunction
      • getFormatDescription

        public String getFormatDescription​(String format)
        Specified by:
        getFormatDescription in interface org.h2gis.api.DriverFunction
      • isSpatialFormat

        public boolean isSpatialFormat​(String extension)
        Specified by:
        isSpatialFormat in interface org.h2gis.api.DriverFunction
      • exportTable

        public String[] exportTable​(Connection connection,
                                    String tableReference,
                                    File fileName,
                                    String csvOptions,
                                    org.h2gis.api.ProgressVisitor progress)
                             throws SQLException,
                                    IOException
        Export a table or a query to a CSV file
        Specified by:
        exportTable in interface org.h2gis.api.DriverFunction
        Parameters:
        connection - Active connection, do not close this connection.
        tableReference - [[catalog.]schema.]table reference
        fileName - File path to read
        csvOptions - the CSV options ie "charset=UTF-8 fieldSeparator=| fieldDelimiter=,"
        progress -
        Throws:
        SQLException
        IOException
      • importFile

        public String[] importFile​(Connection connection,
                                   String tableReference,
                                   File fileName,
                                   String csvOptions,
                                   org.h2gis.api.ProgressVisitor progress)
                            throws SQLException,
                                   IOException
        Specified by:
        importFile in interface org.h2gis.api.DriverFunction
        Parameters:
        connection - Active connection, do not close this connection.
        tableReference - [[catalog.]schema.]table reference
        fileName - File path to read
        csvOptions - the CSV options ie "charset=UTF-8 fieldSeparator=| fieldDelimiter=,"
        progress -
        Throws:
        SQLException
        IOException