@Test public void emitRecords() throws IOException, URISyntaxException { URI archiveURI = getClass().getResource("dwca.zip").toURI(); String tmpDir = "target/tmp/myarchive"; Archive dwcArchive = DwCAUtil.archiveFor(archiveURI, tmpDir); assertHasRecords(dwcArchive); }
public static Archive archiveFor(URI archiveURI, String tmpDir) throws IOException { Archive archive; Path myArchiveFile = Paths.get(archiveURI); try { if (myArchiveFile.toFile().isFile()) { if (StringUtils.isBlank(tmpDir)) { throw new IllegalArgumentException("cannot read [" + archiveURI + "] without a tmpDir"); } Path extractToFolder = Paths.get(tmpDir); archive = DwcFiles.fromCompressed(myArchiveFile, extractToFolder); } else { archive = DwcFiles.fromLocation(myArchiveFile); } } catch (UnsupportedArchiveException e) { throw new IOException("failed to read [" + archiveURI + "]", e); } return archive; }
DwCAUtil { public static Archive archiveFor(URI archiveURI, String tmpDir) throws IOException { Archive archive; Path myArchiveFile = Paths.get(archiveURI); try { if (myArchiveFile.toFile().isFile()) { if (StringUtils.isBlank(tmpDir)) { throw new IllegalArgumentException("cannot read [" + archiveURI + "] without a tmpDir"); } Path extractToFolder = Paths.get(tmpDir); archive = DwcFiles.fromCompressed(myArchiveFile, extractToFolder); } else { archive = DwcFiles.fromLocation(myArchiveFile); } } catch (UnsupportedArchiveException e) { throw new IOException("failed to read [" + archiveURI + "]", e); } return archive; } }
DwCAUtil { public static Archive archiveFor(URI archiveURI, String tmpDir) throws IOException { Archive archive; Path myArchiveFile = Paths.get(archiveURI); try { if (myArchiveFile.toFile().isFile()) { if (StringUtils.isBlank(tmpDir)) { throw new IllegalArgumentException("cannot read [" + archiveURI + "] without a tmpDir"); } Path extractToFolder = Paths.get(tmpDir); archive = DwcFiles.fromCompressed(myArchiveFile, extractToFolder); } else { archive = DwcFiles.fromLocation(myArchiveFile); } } catch (UnsupportedArchiveException e) { throw new IOException("failed to read [" + archiveURI + "]", e); } return archive; }  }
DwCAUtil { public static Archive archiveFor(URI archiveURI, String tmpDir) throws IOException { Archive archive; Path myArchiveFile = Paths.get(archiveURI); try { if (myArchiveFile.toFile().isFile()) { if (StringUtils.isBlank(tmpDir)) { throw new IllegalArgumentException("cannot read [" + archiveURI + "] without a tmpDir"); } Path extractToFolder = Paths.get(tmpDir); archive = DwcFiles.fromCompressed(myArchiveFile, extractToFolder); } else { archive = DwcFiles.fromLocation(myArchiveFile); } } catch (UnsupportedArchiveException e) { throw new IOException("failed to read [" + archiveURI + "]", e); } return archive; }  static Archive archiveFor(URI archiveURI, String tmpDir); }
DwCAUtil { public static Archive archiveFor(URI archiveURI, String tmpDir) throws IOException { Archive archive; Path myArchiveFile = Paths.get(archiveURI); try { if (myArchiveFile.toFile().isFile()) { if (StringUtils.isBlank(tmpDir)) { throw new IllegalArgumentException("cannot read [" + archiveURI + "] without a tmpDir"); } Path extractToFolder = Paths.get(tmpDir); archive = DwcFiles.fromCompressed(myArchiveFile, extractToFolder); } else { archive = DwcFiles.fromLocation(myArchiveFile); } } catch (UnsupportedArchiveException e) { throw new IOException("failed to read [" + archiveURI + "]", e); } return archive; }  static Archive archiveFor(URI archiveURI, String tmpDir);  }