Class JsonWriteDriver


  • public class JsonWriteDriver
    extends Object
    JSON class to write a table or a resultset to a file
    Author:
    Erwan Bocher (CNRS), Sylvain PALOMINOS (Lab-STICC UBS, Chaire GEOTERA, 2020)
    • Constructor Detail

      • JsonWriteDriver

        public JsonWriteDriver​(Connection connection)
        A simple GeoJSON driver to write a spatial table to a GeoJSON file.
        Parameters:
        connection -
    • Method Detail

      • write

        public void write​(org.h2gis.api.ProgressVisitor progress,
                          ResultSet rs,
                          File file,
                          boolean deleteFile)
                   throws SQLException,
                          IOException
        Write a resulset to a json file
        Parameters:
        progress - ProgressVisitor following the writing.
        rs - ResultSet containing the data to write.
        file - Destination file.
        deleteFile - True if the destination files should be deleted, false otherwise.
        Throws:
        SQLException - Exception thrown when an SQL error occurs.
        IOException - Exception when a file writing error occurs.
      • write

        public void write​(org.h2gis.api.ProgressVisitor progress,
                          ResultSet rs,
                          File file,
                          boolean deleteFile,
                          String encoding)
                   throws SQLException,
                          IOException
        Write a resulset to a json file
        Parameters:
        progress - ProgressVisitor following the writing.
        rs - ResultSet containing the data to write.
        file - Destination file.
        deleteFile - True if the destination files should be deleted, false otherwise.
        encoding - Encoding of the destination file.
        Throws:
        SQLException - Exception thrown when an SQL error occurs.
        IOException - Exception when a file writing error occurs.
      • write

        public void write​(org.h2gis.api.ProgressVisitor progress,
                          String tableName,
                          File fileName,
                          boolean deleteFile,
                          String encoding)
                   throws SQLException,
                          IOException
        Write the table to JSON format.
        Parameters:
        progress - ProgressVisitor following the writing.
        tableName - Name of the table to write or SQL query used to gather data to write.
        fileName - Destination file.
        deleteFile - True if the destination files should be deleted, false otherwise.
        encoding - Encoding of the destination file.
        Throws:
        SQLException - Exception thrown when an SQL error occurs.
        IOException - Exception when a file writing error occurs.