GeoTiffProductReaderPlugIn implements ProductReaderPlugIn { static DecodeQualification getDecodeQualificationImpl(ImageInputStream stream) { try { Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(stream); TIFFImageReader imageReader = null; while (imageReaders.hasNext()) { final ImageReader reader = imageReaders.next(); if (reader instanceof TIFFImageReader) { imageReader = (TIFFImageReader) reader; break; } } if (imageReader == null) { return DecodeQualification.UNABLE; } } catch (Exception ignore) { return DecodeQualification.UNABLE; } return DecodeQualification.SUITABLE; }  @Override DecodeQualification getDecodeQualification(Object input); @Override Class[] getInputTypes(); @Override ProductReader createReaderInstance(); @Override String[] getFormatNames(); @Override String[] getDefaultFileExtensions(); @Override String getDescription(Locale locale); @Override BeamFileFilter getProductFileFilter();  }
@Test public void testDecodeQualificationForTIFFWithoutGeoInformation() throws IOException { final Product product = new Product("p", "t", 20, 10); final Band band = product.addBand("band1", ProductData.TYPE_INT8); band.ensureRasterData(); final ImageInputStream inputStream = writeToInputStream(product); final DecodeQualification decodeQualification = GeoTiffProductReaderPlugIn.getDecodeQualificationImpl( inputStream); assertEquals(DecodeQualification.SUITABLE, decodeQualification); }
@Test public void testDecodeQualificationForTIFFWithGeoInformation() throws IOException { final Product product = new Product("p", "t", 20, 10); final Band band = product.addBand("band1", ProductData.TYPE_INT8); band.ensureRasterData(); final MapInfo mapInfo = new MapInfo(UTM.createProjection(26, true), 0, 0, 0, 0, 1, 1, Datum.WGS_84); mapInfo.setSceneWidth(product.getSceneRasterWidth()); mapInfo.setSceneHeight(product.getSceneRasterHeight()); product.setGeoCoding(new MapGeoCoding(mapInfo)); final ImageInputStream inputStream = writeToInputStream(product); final DecodeQualification decodeQualification = GeoTiffProductReaderPlugIn.getDecodeQualificationImpl(inputStream); assertEquals(DecodeQualification.SUITABLE, decodeQualification); }