Revision 54694
Added by Miriam Baglioni about 5 years ago
EFGDownloadPlugin.java | ||
---|---|---|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
import java.util.Arrays; |
5 | 5 |
import java.util.List; |
6 |
import java.util.stream.Collectors; |
|
7 |
import java.util.stream.Stream; |
|
6 | 8 |
|
7 | 9 |
import com.google.gson.Gson; |
8 | 10 |
import eu.dnetlib.enabling.tools.DnetStreamSupport; |
... | ... | |
19 | 21 |
public String extractURL(final String baseURL) throws DownloadPluginException { |
20 | 22 |
if (baseURL == null) |
21 | 23 |
return null; |
22 |
for (String s : suffix) { |
|
23 |
if (baseURL.trim().endsWith(s)) |
|
24 |
return baseURL; |
|
25 |
} |
|
24 |
List<String> collect = suffix.stream().filter(s -> baseURL.toLowerCase().trim().endsWith(s)).collect(Collectors.toList()); |
|
25 |
if (collect.size() > 0) |
|
26 |
return baseURL; |
|
26 | 27 |
return null; |
27 | 28 |
} |
28 | 29 |
|
Also available in: Unified diff
to lower case the extension of the file to be downloaded and refactor to java 8