final String worldFileExtension,
final ImageReaderSpi formatSpecificSpi) throws DataSourceException {
super(input, hints);
ImageReader reader=null;
FileImageInputStreamExt fiis = null;
try {
readerSPI = formatSpecificSpi;
worldFileExt = worldFileExtension;
// //
//
// Source management
//
// //
checkSource(input);
// //
//
// Setting Envelope, GridRange and CRS
//
// //
reader = readerSPI.createReaderInstance();
fiis = new FileImageInputStreamExtImpl(inputFile);
reader.setInput(fiis);
setLayout(reader);
setCoverageProperties(reader);
// //
//
// Information about multiple levels and such
//
// //
getResolutionInfo(reader);
} catch (IOException e) {
if (LOGGER.isLoggable(Level.SEVERE))
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
throw new DataSourceException(e);
} catch (TransformException e) {
if (LOGGER.isLoggable(Level.SEVERE))
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
throw new DataSourceException(e);
}
finally {
// //
//
// Reset and dispose reader
//
// //
if(reader!=null) {
try {
reader.reset();
}catch (Exception e) {
if (LOGGER.isLoggable(Level.FINE))
LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
}
try {
reader.dispose();
}catch (Exception e) {
if (LOGGER.isLoggable(Level.FINE))
LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
}
}
if (fiis!=null){
try {
fiis.close();
}catch (Exception e) {
if (LOGGER.isLoggable(Level.FINE))
LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
}