org.h2gis.functions.io.utility

## Class PRJUtil

- java.lang.Object
- - org.h2gis.functions.io.utility.PRJUtil

    public class PRJUtil
    extends Object

A class to manage PRJ file

Author:
  Erwan Bocher

### Constructor Summary

Constructors
Constructor and Description
`PRJUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `getSRID(File prjFile)` Return the SRID value stored in a prj file If the the prj file - is null, - is empty then a default srid equals to 0 is added.
`static int` `getValidSRID(Connection connection, File prjFile)` Get a valid SRID value from a prj file.
`static boolean` `isSRIDValid(int srid, Connection connection)` This method checks if a SRID value is valid according a list of SRID's avalaible on spatial_ref table of the datababase.
`static void` `writePRJ(Connection connection, int srid, File fileName)` Write a prj file according a given SRID code.
`static void` `writePRJ(Connection connection, org.h2gis.utilities.TableLocation location, String geomField, File fileName)` Write a prj file according the SRID code of an input table

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

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

### Constructor Detail

#### PRJUtil

    public PRJUtil()

### Method Detail

#### getSRID

    public static int getSRID(File prjFile)
                       throws IOException

Return the SRID value stored in a prj file If the the prj file - is null, - is empty then a default srid equals to 0 is added.

Parameters:
  `prjFile` -
Returns:
Throws:
  `IOException`

#### getValidSRID

    public static int getValidSRID(Connection connection,
                                   File prjFile)
                            throws SQLException,
                                   IOException

Get a valid SRID value from a prj file. If the the prj file - is null, - doesn't contain a valid srid code, - is empty * then a default srid equals to 0 is added.

Parameters:
  `connection` -
  `prjFile` -
Returns:
Throws:
  `SQLException`
  `IOException`

#### writePRJ

    public static void writePRJ(Connection connection,
                                org.h2gis.utilities.TableLocation location,
                                String geomField,
                                File fileName)
                         throws SQLException,
                                FileNotFoundException

Write a prj file according the SRID code of an input table

Parameters:
  `connection` - database connection
  `location` - input table name
  `geomField` - geometry field name
  `fileName` - path of the prj file
Throws:
  `SQLException`
  `FileNotFoundException`

#### writePRJ

    public static void writePRJ(Connection connection,
                                int srid,
                                File fileName)
                         throws SQLException,
                                FileNotFoundException

Write a prj file according a given SRID code.

Parameters:
  `connection` - database connection
  `srid` - srid code
  `fileName` - path of the prj file
Throws:
  `SQLException`
  `FileNotFoundException`

#### isSRIDValid

    public static boolean isSRIDValid(int srid,
                                      Connection connection)
                               throws SQLException

This method checks if a SRID value is valid according a list of SRID's avalaible on spatial_ref table of the datababase.

Parameters:
  `srid` -
  `connection` -
Returns:
Throws:
  `SQLException`