- try
- {
- // File idFile = getIdentifiers();
- urls = readIdentifiers(new FileReader(idFileName));
- selectedUrls = new ArrayList<String>();
- checkSelectionMatchesUrls(cachedUrlList);
-
- } catch (IOException e)
- {
- System.out.println("Exception reading URLs from identifiers.org");
- System.out.println(e.getMessage());
- }
- }
-
- private File getIdentifiers() throws IOException
- {
- String identifiersorgUrl = "http://identifiers.org/rest/collections/";
- String outfile = "identifiers.json";
- int BUFFER_SIZE = 4096;
-
- URL url = new URL(identifiersorgUrl);
- InputStream is = new BufferedInputStream(url.openStream());
- FileOutputStream os = new FileOutputStream(outfile);
- byte[] buffer = new byte[BUFFER_SIZE];
- int bytesRead = -1;
- while ((bytesRead = is.read(buffer)) != -1)
- {
- os.write(buffer, 0, bytesRead);
- }
- os.close();
- is.close();
-
- return new File(outfile);
+ urls = readIdentifiers(IdOrgSettings.getDownloadLocation());
+ selectedUrls = new ArrayList<>();
+ checkSelectionMatchesUrls(cachedUrlList);