BeanMappingXMLBuilder implements BeanMappingsBuilder { public void loadInputStreams(List<Supplier<InputStream>> xmlMappingSuppliers) { for (Supplier<InputStream> supplier : xmlMappingSuppliers) { try (InputStream stream = new BufferedInputStream(supplier.get())) { load(stream); } catch (IOException ex) { MappingUtils.throwMappingException(ex); } } } BeanMappingXMLBuilder(BeanContainer beanContainer, ELEngine elEngine); void loadFiles(List<String> files); void loadInputStreams(List<Supplier<InputStream>> xmlMappingSuppliers); @Override List<MappingFileData> build(BeanContainer beanContainer, DestBeanCreator destBeanCreator, PropertyDescriptorFactory propertyDescriptorFactory);  }
@Test public void canLoadStreams() throws IOException { File folder = new File(new File(".").getCanonicalPath() + "/src/test/resources/mappings"); Stream<File> listOfFiles = Arrays.stream(folder.listFiles()); BeanMappingXMLBuilder builder = new BeanMappingXMLBuilder(new BeanContainer(), new NoopELEngine()); builder.loadInputStreams(listOfFiles.map(file -> { Supplier<InputStream> stream = () -> { try { return new BufferedInputStream(new URL("file:" + file.getAbsolutePath()).openStream()); } catch (IOException e) { return null; } }; return stream; }).collect(Collectors.toList())); }