Package org.gdal.ogr

## Class Driver

- java.lang.Object
- - org.gdal.gdal.MajorObject
  - - org.gdal.ogr.Driver

-     public class Driver
      extends MajorObject

  Class Driver is an uninstanciable class providing various methods to represents an operational format driver.

  The Driver class is a binding for the C++ OGRSFDriver class.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DataSource` | `CopyDataSource​(DataSource src_ds, java.lang.String name)` | Creates a new datasource by copying all the layers from the source datasource.
    `DataSource` | `CopyDataSource​(DataSource src_ds, java.lang.String name, java.util.Vector options)` | Creates a new datasource by copying all the layers from the source datasource.
    `DataSource` | `CreateDataSource​(java.lang.String name)` | Attempt to create a new data source based on the passed driver.
    `DataSource` | `CreateDataSource​(java.lang.String name, java.util.Vector options)` | Attempt to create a new data source based on the passed driver.
    `void` | `delete()` | Deprecated. Do not do anything...
    `int` | `DeleteDataSource​(java.lang.String name)` | Destroy a datasource.
    `void` | `Deregister()` | Remove the driver from the list of registered drivers.
    `boolean` | `equals​(java.lang.Object obj)` |
    `java.lang.String` | `getName()` | Fetch name of driver (file format).
    `java.lang.String` | `GetName()` | Fetch name of driver (file format).
    `int` | `hashCode()` |
    `DataSource` | `Open​(java.lang.String name)` | Attempt to open file with this driver.
    `DataSource` | `Open​(java.lang.String name, int update)` | Attempt to open file with this driver.
    `void` | `Register()` | Add a driver to the list of registered drivers.
    `boolean` | `TestCapability​(java.lang.String cap)` | Test if capability is available.

    - ### Methods inherited from class org.gdal.gdal.MajorObject

      `GetDescription, GetMetadata_Dict, GetMetadata_Dict, GetMetadata_List, GetMetadata_List, GetMetadataDomainList, GetMetadataItem, GetMetadataItem, SetDescription, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadataItem, SetMetadataItem`

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

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### delete

          public void delete()

      Deprecated.
      Do not do anything...
      Overrides:
        `delete` in class `MajorObject`

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getName

          public java.lang.String getName()

      Fetch name of driver (file format).

      This name should be relatively short (10-40 characters), and should reflect the underlying file format. For instance "ESRI Shapefile".

      Returns:
        driver name.

    - #### CreateDataSource

          public DataSource CreateDataSource​(java.lang.String name,
                                             java.util.Vector options)

      Attempt to create a new data source based on the passed driver.

      The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation.

      The returned dataset should be properly closed with the DataSource.delete() method.

      Parameters:
        `name` - the name for the new data source.
        `options` - a vector of strings of the format name=value. Options are driver specific, and driver information can be found at the following url: OGR Formats
      Returns:
        null is returned on failure, or a new DataSource on success.

    - #### CreateDataSource

          public DataSource CreateDataSource​(java.lang.String name)

      Attempt to create a new data source based on the passed driver.

      Same as below with options == null.

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateDataSource(String name, java.util.Vector options)`

    - #### CopyDataSource

          public DataSource CopyDataSource​(DataSource src_ds,
                                           java.lang.String name,
                                           java.util.Vector options)

      Creates a new datasource by copying all the layers from the source datasource.
      Parameters:
        `src_ds` - source datasource
        `name` - the name for the new data source.
        `options` - a vector of strings of the format name=value. Options are driver specific, and driver information can be found at the following url: OGR Formats
      Returns:
        null is returned on failure, or a new DataSource on success.

    - #### CopyDataSource

          public DataSource CopyDataSource​(DataSource src_ds,
                                           java.lang.String name)

      Creates a new datasource by copying all the layers from the source datasource.

      Same as below with options == null.

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateDataSource(String name, java.util.Vector options)`

    - #### Open

          public DataSource Open​(java.lang.String name,
                                 int update)

      Attempt to open file with this driver.

      The returned dataset should be properly closed with the DataSource.delete() method.

      Parameters:
        `name` - the name of the file, or data source to try and open.
        `update` - 1 if update access is required, otherwise 0 (the default).
      Returns:
        null on error or if the pass name is not supported by this driver, otherwise a DataSource.

    - #### Open

          public DataSource Open​(java.lang.String name)

      Attempt to open file with this driver.

      Same as below with update == 0.

      Since:
        Java bindings 1.7.0
      See Also:
        `Open(String name, int update)`

    - #### DeleteDataSource

          public int DeleteDataSource​(java.lang.String name)

      Destroy a datasource.

      Destroy the named datasource. Normally it would be safest if the datasource was not open at the time.

      Whether this is a supported operation on this driver case be tested using TestCapability() on ODrCDeleteDataSource.

      Parameters:
        `name` - the name of the datasource to delete.
      Returns:
        0 on success. Otherwise throws a RuntimeException if this is not supported by this driver (or an error code if DontUseExceptions() has been called)

    - #### TestCapability

          public boolean TestCapability​(java.lang.String cap)

      Test if capability is available.

      One of the following data source capability names can be passed into this function, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.

      - ODrCCreateDataSource: True if this driver can support creating data sources.

      - ODrCDeleteDataSource: True if this driver supports deleting data sources.

      The constant forms of the capability names should be used in preference to the strings themselves to avoid misspelling.

      Parameters:
        `cap` - the capability to test.
      Returns:
        true if capability available otherwise false.

    - #### GetName

          public java.lang.String GetName()

      Fetch name of driver (file format).

      This name should be relatively short (10-40 characters), and should reflect the underlying file format. For instance "ESRI Shapefile".

      Returns:
        driver name.

    - #### Register

          public void Register()

      Add a driver to the list of registered drivers.

      If the driver is already registered (based on handle comparison) then the driver isn't registered. New drivers are added at the end of the list of registered drivers.

      Since:
        GDAL 1.8.0

    - #### Deregister

          public void Deregister()

      Remove the driver from the list of registered drivers.
      Since:
        GDAL 1.8.0