@Test public void existsTest() { assertTrue(new IeeeCdfImporter().exists(new ResourceDataSource("ieee14cdf", new ResourceSet("/", "ieee14cdf.txt")))); }
@Override public boolean exists(ReadOnlyDataSource dataSource) { try { if (dataSource.exists(null, EXT)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, EXT)))) { String titleLine = reader.readLine(); if (titleLine != null) { return titleLine.length() >= 44 && titleLine.charAt(3) == '/' && titleLine.charAt(6) == '/' && (titleLine.charAt(43) == 'S' || titleLine.charAt(43) == 'W'); } } } } catch (IOException e) { throw new UncheckedIOException(e); } return false; }
IeeeCdfImporter implements Importer { @Override public boolean exists(ReadOnlyDataSource dataSource) { try { if (dataSource.exists(null, EXT)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, EXT)))) { String titleLine = reader.readLine(); if (titleLine != null) { return titleLine.length() >= 44 && titleLine.charAt(3) == '/' && titleLine.charAt(6) == '/' && (titleLine.charAt(43) == 'S' || titleLine.charAt(43) == 'W'); } } } } catch (IOException e) { throw new UncheckedIOException(e); } return false; } }
IeeeCdfImporter implements Importer { @Override public boolean exists(ReadOnlyDataSource dataSource) { try { if (dataSource.exists(null, EXT)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, EXT)))) { String titleLine = reader.readLine(); if (titleLine != null) { return titleLine.length() >= 44 && titleLine.charAt(3) == '/' && titleLine.charAt(6) == '/' && (titleLine.charAt(43) == 'S' || titleLine.charAt(43) == 'W'); } } } } catch (IOException e) { throw new UncheckedIOException(e); } return false; }  }
IeeeCdfImporter implements Importer { @Override public boolean exists(ReadOnlyDataSource dataSource) { try { if (dataSource.exists(null, EXT)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, EXT)))) { String titleLine = reader.readLine(); if (titleLine != null) { return titleLine.length() >= 44 && titleLine.charAt(3) == '/' && titleLine.charAt(6) == '/' && (titleLine.charAt(43) == 'S' || titleLine.charAt(43) == 'W'); } } } } catch (IOException e) { throw new UncheckedIOException(e); } return false; }  @Override String getFormat(); @Override List<Parameter> getParameters(); @Override String getComment(); @Override boolean exists(ReadOnlyDataSource dataSource); @Override void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource); @Override Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters); }
IeeeCdfImporter implements Importer { @Override public boolean exists(ReadOnlyDataSource dataSource) { try { if (dataSource.exists(null, EXT)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(dataSource.newInputStream(null, EXT)))) { String titleLine = reader.readLine(); if (titleLine != null) { return titleLine.length() >= 44 && titleLine.charAt(3) == '/' && titleLine.charAt(6) == '/' && (titleLine.charAt(43) == 'S' || titleLine.charAt(43) == 'W'); } } } } catch (IOException e) { throw new UncheckedIOException(e); } return false; }  @Override String getFormat(); @Override List<Parameter> getParameters(); @Override String getComment(); @Override boolean exists(ReadOnlyDataSource dataSource); @Override void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource); @Override Network importData(ReadOnlyDataSource dataSource, NetworkFactory networkFactory, Properties parameters);  }