@Test public void testAddImagesFromFolder() throws Exception { Path path = Paths.get(BaseTest.getResource(".", this.getClass())); ImageLib imageLib = new ImageLib(); imageLib.addImagesFromFolder(path); List<String> strings = Arrays.asList("calc.jpged.jpg", "calc.jpged", "calc.pngfile.PNG", "calc.pngfile"); for (String s : strings) { assertNotNull(imageLib.getImage(s)); assertNotNull(imageLib.getPattern(s)); } }
public void addImagesFromFolder(Path... paths) throws IOException { for (Path path : paths) { logger.info("load all pics from \"" + path.toString() + "\" in picLib"); DirectoryStream<Path> directory = Files.newDirectoryStream(path); for (Path file : directory) { if (!Files.isDirectory(file)) { try { ImageLibObject imageLibObject = new ImageLibObject(file); if (imageLibObject.getId() != null) { put(imageLibObject.getId(), imageLibObject); } } catch (SakuliCheckedException e) { logger.error(e.getMessage()); } } } } }
ImageLib extends HashMap<String, ImageLibObject> { public void addImagesFromFolder(Path... paths) throws IOException { for (Path path : paths) { logger.info("load all pics from \"" + path.toString() + "\" in picLib"); DirectoryStream<Path> directory = Files.newDirectoryStream(path); for (Path file : directory) { if (!Files.isDirectory(file)) { try { ImageLibObject imageLibObject = new ImageLibObject(file); if (imageLibObject.getId() != null) { put(imageLibObject.getId(), imageLibObject); } } catch (SakuliCheckedException e) { logger.error(e.getMessage()); } } } } } }
ImageLib extends HashMap<String, ImageLibObject> { public void addImagesFromFolder(Path... paths) throws IOException { for (Path path : paths) { logger.info("load all pics from \"" + path.toString() + "\" in picLib"); DirectoryStream<Path> directory = Files.newDirectoryStream(path); for (Path file : directory) { if (!Files.isDirectory(file)) { try { ImageLibObject imageLibObject = new ImageLibObject(file); if (imageLibObject.getId() != null) { put(imageLibObject.getId(), imageLibObject); } } catch (SakuliCheckedException e) { logger.error(e.getMessage()); } } } } }  }
ImageLib extends HashMap<String, ImageLibObject> { public void addImagesFromFolder(Path... paths) throws IOException { for (Path path : paths) { logger.info("load all pics from \"" + path.toString() + "\" in picLib"); DirectoryStream<Path> directory = Files.newDirectoryStream(path); for (Path file : directory) { if (!Files.isDirectory(file)) { try { ImageLibObject imageLibObject = new ImageLibObject(file); if (imageLibObject.getId() != null) { put(imageLibObject.getId(), imageLibObject); } } catch (SakuliCheckedException e) { logger.error(e.getMessage()); } } } } }  void addImagesFromFolder(Path... paths); Pattern getPattern(String imageName); ImageLibObject getImage(String imageName); }
ImageLib extends HashMap<String, ImageLibObject> { public void addImagesFromFolder(Path... paths) throws IOException { for (Path path : paths) { logger.info("load all pics from \"" + path.toString() + "\" in picLib"); DirectoryStream<Path> directory = Files.newDirectoryStream(path); for (Path file : directory) { if (!Files.isDirectory(file)) { try { ImageLibObject imageLibObject = new ImageLibObject(file); if (imageLibObject.getId() != null) { put(imageLibObject.getId(), imageLibObject); } } catch (SakuliCheckedException e) { logger.error(e.getMessage()); } } } } }  void addImagesFromFolder(Path... paths); Pattern getPattern(String imageName); ImageLibObject getImage(String imageName);  }