# Interface WritableGridCoverageResource

All Superinterfaces:
  `DataSet`, `GridCoverageResource`, `Resource`

public interface WritableGridCoverageResource extends GridCoverageResource
A `GridCoverageResource` with writing capabilities. `WritableGridCoverageResource` inherits the reading capabilities from its parent and adds a write operation. Some aspects of the write operation can be controlled by options, which may be `DataStore`-specific.

Since:
  1.2

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `WritableGridCoverageResource​.CommonOption`
  Write options that may apply to any data store.
  `static interface`
  `WritableGridCoverageResource​.Option`
  Configuration of the process of writing a coverage in a data store.

  ### Nested classes/interfaces inherited from interface Resource

  `Resource​.FileSet`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `write(GridCoverage coverage, WritableGridCoverageResource​.Option... options)`
  Writes a new coverage in the data store for this resource.

  ### Methods inherited from interface GridCoverageResource

  `getEnvelope, getGridGeometry, getLoadingStrategy, getResolutions, getSampleDimensions, read, setLoadingStrategy, subset`

  ### Methods inherited from interface Resource

  `addListener, getFileSet, getIdentifier, getMetadata, removeListener`

- ## Method Details

  - ### write

    void write(GridCoverage coverage, WritableGridCoverageResource.Option... options) throws DataStoreException
    Writes a new coverage in the data store for this resource. If a coverage already exists for this resource, then the behavior of this method is determined by the given options. If no option is specified, the default behavior is to fail if writing a coverage would cause an existing coverage to be overwritten. This behavior can be modified by requesting the `replacement` or update of existing coverages.
    Parameters:
      `coverage` - new data to write in the data store for this resource.
      `options` - configuration of the write operation. May be `DataStore`-specific options (e.g. for compression, encryption, etc).
    Throws:
      `IllegalArgumentException` - if mutually exclusive options are specified.
      `ReadOnlyStorageException` - if the resource is (possibly temporarily) read-only.
      `ResourceAlreadyExistsException` - if a coverage already exists in this resource and no `REPLACE` or `UPDATE` option have been specified.
      `IncompatibleResourceException` - if the given resource cannot be written, for example because its grid geometry is unsupported by this resource.
      `DataStoreException` - if another error occurred while writing data in the underlying data store.