KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * ReadOnlySfxDriver.java
3  *
4  * Created on 24. Dezember 2005, 00:01
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.archive.Archive;
25 import de.schlichtherle.io.archive.spi.InputArchive;
26 import de.schlichtherle.io.archive.spi.OutputArchive;
27 import java.io.FileNotFoundException JavaDoc;
28 import java.io.IOException JavaDoc;
29 import java.io.OutputStream JavaDoc;
30 import java.io.UnsupportedEncodingException JavaDoc;
31 import java.util.logging.Level JavaDoc;
32 import java.util.logging.Logger JavaDoc;
33
34 /**
35  * A {@link Zip32Driver} which reads and writes Self Executable (SFX) ZIP32
36  * archives.
37  * <p>
38  * <b>Warning:</b> Modifying SFX archives usually voids the SFX code in the
39  * preamble!
40  * This is because most SFX implementations do not tolerate the contents of
41  * the archive to be modified (by intention or accident).
42  * When executing the SFX code of a modified archive, anything may happen:
43  * The SFX code may be terminating with an error message, crash, silently
44  * produce corrupted data, or even something more evil.
45  * However, an archive modified with this driver is still a valid ZIP file.
46  * So you may still extract the modified archive using a regular ZIP utility.
47  * <p>
48  * Instances of this class are immutable.
49  *
50  * @author Christian Schlichtherle
51  * @version @version@
52  * @since TrueZIP 6.0
53  */

54 public class ReadWriteSfxDriver extends AbstractSfxDriver {
55
56     /**
57      * Equivalent to {@link AbstractSfxDriver#AbstractSfxDriver(String, boolean, boolean, Icon, Icon)
58      * super(ENCODING, true, false, null, null)}.
59      * These parameters are based on heuristics.
60      */

61     public ReadWriteSfxDriver() {
62         super(ENCODING, true, false, null, null);
63     }
64
65     /**
66      * Equivalent to {@link AbstractSfxDriver#AbstractSfxDriver(String, boolean, boolean, Icon, Icon)
67      * super(encoding, true, false, null, null)}.
68      * These parameters are based on heuristics.
69      */

70     public ReadWriteSfxDriver(String JavaDoc encoding) {
71         super(encoding, true, false, null, null);
72     }
73
74     public OutputArchive createOutputArchive(
75             final Archive archive,
76             final OutputStream JavaDoc out,
77             final InputArchive source)
78     throws UnsupportedEncodingException JavaDoc, IOException JavaDoc {
79         return createZip32OutputArchive(
80                 out, getEncoding(), (Zip32InputArchive) source);
81     }
82 }
83
Popular Tags