Package org.gdal.ogr

Class 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 Details

    • delete

      public void delete()
      Deprecated.
      Do not do anything...
      Overrides:
      delete in class MajorObject
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getName

      public 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(String name, 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(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:
    • CopyDataSource

      public DataSource CopyDataSource(DataSource src_ds, String name, 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, 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:
    • Open

      public DataSource Open(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(String name)
      Attempt to open file with this driver.

      Same as below with update == 0.

      Since:
      Java bindings 1.7.0
      See Also:
    • DeleteDataSource

      public int DeleteDataSource(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(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 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