MatpowerImporter implements Importer { @Override public void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource) { Objects.requireNonNull(fromDataSource); Objects.requireNonNull(toDataSource); try { try (InputStream is = fromDataSource.newInputStream(null, EXT); OutputStream os = toDataSource.newOutputStream(null, EXT, false)) { ByteStreams.copy(is, os); } } catch (IOException e) { throw new UncheckedIOException(e); } }  @Override boolean exists(ReadOnlyDataSource dataSource); @Override String getComment(); @Override String getFormat(); @Override void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource); @Override List<Parameter> getParameters(); @Override Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters);  }
@Test public void copyTest() throws IOException { MatpowerModel model = MatpowerModelFactory.create9(); Path matpowerBinCase = tmpDir.resolve(model.getCaseName() + ".mat"); MatpowerWriter.write(model, matpowerBinCase); new MatpowerImporter().copy(new FileDataSource(tmpDir, model.getCaseName()), new FileDataSource(tmpDir, "copy")); assertTrue(Files.exists(tmpDir.resolve("copy.mat"))); }