KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > io > archive > zip > Zip32InputArchive


1 /*
2  * Zip32InputArchive.java
3  *
4  * Created on 27. Februar 2006, 09:12
5  */

6 /*
7  * Copyright 2006 Schlichtherle IT Services
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */

21
22 package de.schlichtherle.io.archive.zip;
23
24 import de.schlichtherle.io.*;
25 import de.schlichtherle.io.archive.spi.*;
26 import de.schlichtherle.io.rof.*;
27 import de.schlichtherle.io.util.*;
28 import de.schlichtherle.util.zip.*;
29 import de.schlichtherle.util.zip.ZipEntry;
30
31 import java.io.*;
32 import java.util.*;
33 import java.util.zip.*;
34
35 /**
36  * An implementation of {@link InputArchive} to read ZIP32 archives.
37  *
38  * @see Zip32Driver
39  *
40  * @author Christian Schlichtherle
41  * @version @version@
42  * @since TrueZIP 6.0
43  */

44 public class Zip32InputArchive
45         extends BasicZipFile
46         implements InputArchive {
47
48     private InputArchiveMetaData metaData;
49
50     public Zip32InputArchive(
51             ReadOnlyFile rof,
52             String JavaDoc encoding,
53             boolean preambled,
54             boolean postambled)
55     throws NullPointerException JavaDoc,
56             UnsupportedEncodingException,
57             FileNotFoundException,
58             ZipException,
59             IOException {
60         super(rof, encoding, preambled, postambled);
61     }
62
63     protected ZipEntry createZipEntry(String JavaDoc name) {
64         return new Zip32Entry(Paths.normalize(name, '/'));
65     }
66
67     public int getNumArchiveEntries() {
68         return super.size();
69     }
70
71     public Enumeration getArchiveEntries() {
72         return super.entries();
73     }
74
75     public ArchiveEntry getArchiveEntry(final String JavaDoc name) {
76         return (Zip32Entry) super.getEntry(name);
77     }
78
79     public InputStream getInputStream(
80             final ArchiveEntry entry,
81             final ArchiveEntry dstEntry)
82     throws IOException {
83         return super.getInputStream(
84                 entry.getName(), false, !(dstEntry instanceof Zip32Entry));
85     }
86
87     //
88
// Metadata implementation.
89
//
90

91     public InputArchiveMetaData getMetaData() {
92         return metaData;
93     }
94
95     public void setMetaData(InputArchiveMetaData metaData) {
96         this.metaData = metaData;
97     }
98 }
99
Popular Tags