Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ZipXmlDocCollection |
|
| 2.5;2.5 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.core.api.impex.xml; | |
17 | ||
18 | import java.io.File; | |
19 | import java.io.IOException; | |
20 | import java.util.Enumeration; | |
21 | import java.util.zip.ZipEntry; | |
22 | import java.util.zip.ZipFile; | |
23 | ||
24 | /** | |
25 | * For uploading zip files full of xml goodness. | |
26 | * | |
27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
28 | */ | |
29 | 0 | public class ZipXmlDocCollection extends BaseXmlDocCollection { |
30 | private ZipFile zipFile; | |
31 | public ZipXmlDocCollection(File file) throws IOException { | |
32 | 0 | super(file); |
33 | 0 | zipFile = new ZipFile(file); |
34 | 0 | Enumeration<? extends ZipEntry> e = zipFile.entries(); |
35 | 0 | while (e.hasMoreElements()) { |
36 | 0 | ZipEntry zipEntry = e.nextElement(); |
37 | 0 | if (!zipEntry.isDirectory() && zipEntry.getName().toLowerCase().endsWith(".xml")) { |
38 | 0 | xmlDocs.add(new ZipXmlDoc(zipFile, zipEntry, this)); |
39 | } | |
40 | 0 | } |
41 | 0 | } |
42 | public void close() throws IOException { | |
43 | 0 | zipFile.close(); |
44 | 0 | } |
45 | } |