@Override public boolean accept(File fileToAccept) { if (fileToAccept.isDirectory()) { return true; } return StringHelper.endsWithIgnoreCase(fileToAccept.getName(), this.driverInfo.getExtensionName()); }
@Override public DecodeQualification getDecodeQualification(Object input) { if (GDALInstallInfo.INSTANCE.isPresent()) { String filePath = null; if (input instanceof String) { filePath = (String)input; } else if (input instanceof File) { filePath = ((File)input).getAbsolutePath(); } else if (input instanceof Path) { filePath = ((Path)input).toFile().getAbsolutePath(); } else { throw new IllegalArgumentException("Unknown type '"+input.getClass()+"' for input '"+ input.toString()+"'."); } Iterator<String> it = this.extensions.iterator(); while (it.hasNext()) { String extension = it.next(); if (StringHelper.endsWithIgnoreCase(filePath, extension)) { return DecodeQualification.SUITABLE; } } } return DecodeQualification.UNABLE; }
if (StringHelper.endsWithIgnoreCase(filePath, ".rat.hdr") || StringHelper.endsWithIgnoreCase(filePath, "bin.hdr") || StringHelper.endsWithIgnoreCase(filePath, ".snaphu.hdr")) { if (StringHelper.endsWithIgnoreCase(filePath, ".hdr")) { File hdrFile = FileUtils.exchangeExtension(inputFile, ".hdr"); File dblFile = FileUtils.exchangeExtension(inputFile, ".dbl");
if (!StringHelper.endsWithIgnoreCase(fileName, this.writerDriver.getExtensionName())) { throw new IllegalArgumentException("The extension of the file name '" + fileName + "' is unknown.");
private void copyMasks(Product sourceProduct, Product targetProduct, String...bandNames) { if (isSentinelProduct(sourceProduct)) { final ProductNodeGroup<Mask> sourceMaskGroup = sourceProduct.getMaskGroup(); int nodeCount = sourceMaskGroup.getNodeCount(); for (int i = 0; i < nodeCount; i++) { final Mask mask = sourceMaskGroup.get(i); String maskName = mask.getName(); if (!targetProduct.getMaskGroup().contains(maskName) && StringHelper.endsWithIgnoreCase(maskName, bandNames)) { if (mask.getImageType().transferMask(mask, targetProduct) == null) { Mask targetMask = new Mask(maskName, mask.getRasterWidth(), mask.getRasterHeight(), mask.getImageType()); ProductUtils.copyRasterDataNodeProperties(mask, targetMask); targetMask.setSourceImage(mask.getSourceImage()); targetProduct.getMaskGroup().add(targetMask); } } } } else { final ProductNodeGroup<Mask> sourceMaskGroup = sourceProduct.getMaskGroup(); for (int i = 0; i < sourceMaskGroup.getNodeCount(); i++) { final Mask mask = sourceMaskGroup.get(i); if (!targetProduct.getMaskGroup().contains(mask.getName())) { mask.getImageType().transferMask(mask, targetProduct); } } } }