| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ZipXmlDoc |
|
| 1.4;1.4 |
| 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.IOException; | |
| 19 | import java.io.InputStream; | |
| 20 | import java.util.zip.ZipEntry; | |
| 21 | import java.util.zip.ZipFile; | |
| 22 | ||
| 23 | /** | |
| 24 | * An XmlDoc implementation backed by a ZipEntry in a ZipFile | |
| 25 | * @see org.kuali.rice.core.api.impex.xml.batch.XmlDoc | |
| 26 | * @see org.kuali.rice.core.api.impex.xml.impl.impex.BaseXmlDoc | |
| 27 | * @see org.kuali.rice.core.api.impex.xml.ZipXmlDocCollection | |
| 28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 29 | */ | |
| 30 | class ZipXmlDoc extends BaseXmlDoc { | |
| 31 | private ZipFile zipFile; | |
| 32 | private ZipEntry zipEntry; | |
| 33 | public ZipXmlDoc(ZipFile zipFile, ZipEntry zipEntry, XmlDocCollection collection) { | |
| 34 | 0 | super(collection); |
| 35 | 0 | this.zipFile = zipFile; |
| 36 | 0 | this.zipEntry = zipEntry; |
| 37 | 0 | } |
| 38 | public String getName() { | |
| 39 | 0 | return zipEntry.getName(); |
| 40 | } | |
| 41 | public InputStream getStream() throws IOException { | |
| 42 | 0 | return zipFile.getInputStream(zipEntry); |
| 43 | } | |
| 44 | public int hashCode() { | |
| 45 | 0 | return zipEntry.hashCode(); |
| 46 | } | |
| 47 | public boolean equals(Object o) { | |
| 48 | 0 | if (!(o instanceof ZipXmlDoc)) return false; |
| 49 | 0 | return zipEntry.equals(((ZipXmlDoc) o).zipEntry); |
| 50 | } | |
| 51 | } |