Package org.h2gis.functions.io.json

## Class JsonWriteDriver

- java.lang.Object
- - org.h2gis.functions.io.json.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 Summary

Constructors
`JsonWriteDriver​(Connection connection)` A simple GeoJSON driver to write a spatial table to a GeoJSON file.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `write​(org.h2gis.api.ProgressVisitor progress, String tableName, File fileName, boolean deleteFile, String encoding)` Write the table to JSON format.
`void` `write​(org.h2gis.api.ProgressVisitor progress, ResultSet rs, File file, boolean deleteFile)` Write a resulset to a json file
`void` `write​(org.h2gis.api.ProgressVisitor progress, ResultSet rs, File file, boolean deleteFile, String encoding)` Write a resulset to a json file

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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.