@Override protected boolean isValidItem(String item) { if (super.isValidItem(item)) { final File file = new File(item); return _productReaderPlugIn.getDecodeQualification(file) != DecodeQualification.UNABLE; } return false; } }
private static List<PluginEntry> getPluginsForFile(File file, DecodeQualification desiredQualification) { final Iterator<ProductReaderPlugIn> allReaderPlugIns = ProductIOPlugInManager.getInstance().getAllReaderPlugIns(); final List<PluginEntry> possiblePlugIns = new ArrayList<>(); allReaderPlugIns.forEachRemaining(plugIn -> { final DecodeQualification qualification = plugIn.getDecodeQualification(file); if (qualification == desiredQualification) { possiblePlugIns.add(new PluginEntry(plugIn, qualification)); } }); return possiblePlugIns; }
private static List<String> getFormatsForFile(final File file) { final Iterator<ProductReaderPlugIn> allReaderPlugIns = ProductIOPlugInManager.getInstance().getAllReaderPlugIns(); final List<String> formatNameList = new ArrayList<>(); while (allReaderPlugIns.hasNext()) { ProductReaderPlugIn reader = allReaderPlugIns.next(); String[] formatNames = reader.getFormatNames(); for (String formatName : formatNames) { if(file == null || reader.getDecodeQualification(file) != DecodeQualification.UNABLE && !formatNameList.contains(formatName)) { formatNameList.add(formatName); } } } formatNameList.sort(String::compareTo); formatNameList.add(0, ANY_FORMAT); return formatNameList; }
protected Product testReader(final File inputFile) throws Exception { if(!inputFile.exists()){ TestUtils.skipTest(this, inputFile +" not found"); return null; } final DecodeQualification canRead = readerPlugIn.getDecodeQualification(inputFile); if(canRead != DecodeQualification.INTENDED) { throw new Exception("Reader not intended"); } final Product product = reader.readProductNodes(inputFile, null); if(product == null) { throw new Exception("Unable to read product"); } TestUtils.verifyProduct(product, true, true); validateMetadata(product); return product; }
@Override protected Product readProductNodesImpl() throws IOException { productDirectory = getInput(super.getInput()); if (getReaderPlugIn().getDecodeQualification(super.getInput()) == DecodeQualification.UNABLE) { throw new IOException("The selected product cannot be read with the current reader.");
@Override protected Product readProductNodesImpl() throws IOException { if (getReaderPlugIn().getDecodeQualification(super.getInput()) == DecodeQualification.UNABLE) { throw new IOException("The selected product cannot be read with the current reader.");