Package org.geotools.api.coverage.grid
Interface GridCoverageWriter
-
- All Known Implementing Classes:
AbstractGridCoverageWriter
,ArcGridWriter
,GeoTiffWriter
,GrassCoverageWriter
,WorldImageWriter
public interface GridCoverageWriter
Support for writing grid coverages into a persistent store. Instance ofGridCoverageWriter
are obtained through a call toAbstractGridFormat.getWriter
. Grid coverages are usually added to the output stream in a sequential order.- Since:
- GeoAPI 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
ImageWriter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
dispose()
Allows any resources held by this object to be released.Object
getDestination()
Returns the output destination.Format
getFormat()
Returns the format handled by thisGridCoverageWriter
.String[]
getMetadataNames()
Returns the list of metadata keywords associated with the output destination as a whole (not associated with any particular grid coverage).void
setCurrentSubname(String name)
Set the name for the next grid coverage to write within the output destination.void
setMetadataValue(String name, String value)
Sets the metadata value for a given metadata name.void
write(GridCoverage coverage, GeneralParameterValue... parameters)
Writes the specified grid coverage.
-
-
-
Method Detail
-
getFormat
Format getFormat()
Returns the format handled by thisGridCoverageWriter
.
-
getDestination
Object getDestination()
Returns the output destination. This is the object passed to theAbstractGridFormat.getWriter
method. It can be aString
, anOutputStream
, aFileChannel
, etc.
-
getMetadataNames
String[] getMetadataNames()
Returns the list of metadata keywords associated with the output destination as a whole (not associated with any particular grid coverage). If no metadata is allowed, the array will be empty.- Returns:
- The list of metadata keywords for the output destination.
- Throws:
IOException
- if an error occurs during reading or writing.
-
setMetadataValue
void setMetadataValue(String name, String value) throws IOException
Sets the metadata value for a given metadata name.- Parameters:
name
- Metadata keyword for which to set the metadata.value
- The metadata value for the given metadata name.- Throws:
IOException
- if an error occurs during writing.
-
setCurrentSubname
void setCurrentSubname(String name) throws IOException
Set the name for the next grid coverage to write within the output destination. The subname can been fetch later at reading time.- Throws:
IOException
- if an error occurs during writing.
-
write
void write(GridCoverage coverage, GeneralParameterValue... parameters) throws IllegalArgumentException, IOException
Writes the specified grid coverage.- Parameters:
coverage
- The grid coverage to write.parameters
- An optional set of parameters. Should be any or all of the parameters returned byFormat.getWriteParameters()
.- Throws:
InvalidParameterNameException
- if a parameter inparameters
doesn't have a recognized name.InvalidParameterValueException
- if a parameter inparameters
doesn't have a valid value.ParameterNotFoundException
- if a parameter was required for the operation but was not provided in theparameters
list.FileFormatNotCompatibleWithGridCoverageException
- if the grid coverage can't be exported in the writer format.IOException
- if the export failed for some other input/output reason, includingIIOException
if an error was thrown by the underlying image library.IllegalArgumentException
-
dispose
void dispose() throws IOException
Allows any resources held by this object to be released. The result of calling any other method subsequent to a call to this method is undefined. It is important for applications to call this method when they know they will no longer be using thisGridCoverageWriter
. Otherwise, the writer may continue to hold on to resources indefinitely.- Throws:
IOException
- if an error occured while disposing resources (for example while flushing data and closing a file).
-
-