Revision 2720ea2c
Added by Andreas Müller over 3 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DwcaZipToStreamConverter.java | ||
---|---|---|
46 | 46 |
* This class transforms a Darwin Core Archive zip file into a set of CSVReaderInputStreams. |
47 | 47 |
* For each data file included in the zip it creates one stream by evaluating the meta file. |
48 | 48 |
* Ecological metadata handling is still unclear. |
49 |
* |
|
49 | 50 |
* @author a.mueller |
50 | 51 |
* @since 17.10.2011 |
51 |
* |
|
52 | 52 |
*/ |
53 | 53 |
public class DwcaZipToStreamConverter<STATE extends DwcaImportState> { |
54 | 54 |
private static Logger logger = Logger.getLogger(DwcaZipToStreamConverter.class); |
... | ... | |
67 | 67 |
TermUri.GBIF_DESCRIPTION, |
68 | 68 |
TermUri.GBIF_DISTRIBUTION, |
69 | 69 |
TermUri.GBIF_IMAGE |
70 |
|
|
71 | 70 |
); |
72 | 71 |
|
73 | 72 |
private final URI dwcaZip; |
... | ... | |
80 | 79 |
return new DwcaZipToStreamConverter(dwcaZip); |
81 | 80 |
} |
82 | 81 |
|
83 |
|
|
84 | 82 |
//************************ CONSTRUCTOR *********************************/ |
85 | 83 |
|
86 |
/** |
|
87 |
* Constructor |
|
88 |
* @param dwcaZip |
|
89 |
*/ |
|
90 | 84 |
public DwcaZipToStreamConverter(URI dwcaZip) { |
91 | 85 |
this.dwcaZip = dwcaZip; |
92 | 86 |
initArchive(); |
93 | 87 |
} |
94 | 88 |
|
95 |
|
|
96 | 89 |
protected Archive getArchive(){ |
97 | 90 |
return this.archive; |
98 | 91 |
} |
... | ... | |
259 | 252 |
// } |
260 | 253 |
// |
261 | 254 |
|
262 |
/** |
|
263 |
* @return |
|
264 |
* @throws IOException |
|
265 |
*/ |
|
266 | 255 |
private InputStream makeInputStream(String name) throws IOException { |
267 | 256 |
File file = new File(dwcaZip); |
268 | 257 |
if (! file.isFile() || ! file.exists()){ |
... | ... | |
286 | 275 |
InputStream metaInputStream = zip.getInputStream(metaEntry); |
287 | 276 |
return metaInputStream; |
288 | 277 |
} |
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
} |
|
278 |
} |
Also available in: Unified diff
cleanup