@Test public void dietMatrix() throws StudyImporterException { List<String> matrices = new ArrayList<>(); DatasetImporterForGlobalWebDb importer = new DatasetImporterForGlobalWebDb(null, null); importer.setDataset(new DatasetLocal(inStream -> inStream)); importer .importDietMatrices(URI.create("classpath:/org/eol/globi/data/globalwebdb-test.zip"), matrices::add); assertThat(matrices.size(), is(10)); assertThat(matrices.get(0), is(aDietMatrix)); }
void importDietMatrices(URI archiveURL, DietMatrixListener matrix) throws StudyImporterException { try (InputStream inputStream = getDataset().retrieve(archiveURL); ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (entry.getName().matches("WEB.*\\.csv$")) { matrix.onMatrix(IOUtils.toString(zipInputStream, StandardCharsets.UTF_8)); } else { IOUtils.copy(zipInputStream, new NullOutputStream()); } } } catch (IOException e) { throw new StudyImporterException(e); } }
DatasetImporterForGlobalWebDb extends DatasetImporterWithListener { void importDietMatrices(URI archiveURL, DietMatrixListener matrix) throws StudyImporterException { try (InputStream inputStream = getDataset().retrieve(archiveURL); ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (entry.getName().matches("WEB.*\\.csv$")) { matrix.onMatrix(IOUtils.toString(zipInputStream, StandardCharsets.UTF_8)); } else { IOUtils.copy(zipInputStream, new NullOutputStream()); } } } catch (IOException e) { throw new StudyImporterException(e); } } }
DatasetImporterForGlobalWebDb extends DatasetImporterWithListener { void importDietMatrices(URI archiveURL, DietMatrixListener matrix) throws StudyImporterException { try (InputStream inputStream = getDataset().retrieve(archiveURL); ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (entry.getName().matches("WEB.*\\.csv$")) { matrix.onMatrix(IOUtils.toString(zipInputStream, StandardCharsets.UTF_8)); } else { IOUtils.copy(zipInputStream, new NullOutputStream()); } } } catch (IOException e) { throw new StudyImporterException(e); } } DatasetImporterForGlobalWebDb(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForGlobalWebDb extends DatasetImporterWithListener { void importDietMatrices(URI archiveURL, DietMatrixListener matrix) throws StudyImporterException { try (InputStream inputStream = getDataset().retrieve(archiveURL); ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (entry.getName().matches("WEB.*\\.csv$")) { matrix.onMatrix(IOUtils.toString(zipInputStream, StandardCharsets.UTF_8)); } else { IOUtils.copy(zipInputStream, new NullOutputStream()); } } } catch (IOException e) { throw new StudyImporterException(e); } } DatasetImporterForGlobalWebDb(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); }
DatasetImporterForGlobalWebDb extends DatasetImporterWithListener { void importDietMatrices(URI archiveURL, DietMatrixListener matrix) throws StudyImporterException { try (InputStream inputStream = getDataset().retrieve(archiveURL); ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { if (entry.getName().matches("WEB.*\\.csv$")) { matrix.onMatrix(IOUtils.toString(zipInputStream, StandardCharsets.UTF_8)); } else { IOUtils.copy(zipInputStream, new NullOutputStream()); } } } catch (IOException e) { throw new StudyImporterException(e); } } DatasetImporterForGlobalWebDb(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy();  }