KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > compressor > PackCompressor


1 /*
2  * $Id: PackCompressor.java 1708 2007-01-13 18:31:26Z jponge $
3  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
4  *
5  * http://www.izforge.com/izpack/
6  * http://developer.berlios.de/projects/izpack/
7  *
8  * Copyright 2005 Klaus Bartz
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */

22 package com.izforge.izpack.compressor;
23
24 import java.io.OutputStream JavaDoc;
25
26 import com.izforge.izpack.compiler.Compiler;
27
28
29 /**
30  * IzPack will be able to support different compression methods for the
31  * packs included in the installation jar file.
32  * This interface declares the handler of one compression format.
33  *
34  * @author Klaus Bartz
35  */

36
37 public interface PackCompressor
38 {
39
40     /**
41      * Returns a newly created output stream which write method
42      * writes the given input encoded to the defined output stream.
43      * Attention! This method will be returned a valid output stream
44      * only if it is used in the IzPack compiler, or if this pack compressor
45      * needs no external classes. A call in the
46      * installation should be throw if external classes are used.
47      * The implementation should load the needed classes via reflection
48      * because classes are not present in the installation.
49      * @param os output stream to be used as listener
50      * @return a newly created encoding output stream
51      * @throws Exception
52      */

53     OutputStream JavaDoc getOutputStream(OutputStream JavaDoc os) throws Exception JavaDoc;
54     
55     /**
56      * Returns all symbolic names which are used for this compressor.
57      * @return all symbolic names which are used for this compressor
58      */

59     String JavaDoc []getCompressionFormatSymbols();
60     
61     /**
62      * Returns the path where the compiler can find the classes;
63      * normaly this is a path to a jar file.
64      * If no additional classes are needed, this method should return null.
65      * @return the path where the compiler can find the classes
66      */

67     String JavaDoc[] getContainerPaths();
68     
69     /**
70      * Returns the qualified names of all needed classes for decoding.
71      * All class files should be placed in the container which will
72      * be referred by the method getContainerPath.
73      * If no additional classes are needed, this method should return null.
74      * @return qualified names of all needed classes for decoding
75      */

76     String JavaDoc[][] getDecoderClassNames();
77  
78     /**
79      * Returns the qualified name of the encoding output stream.
80      * The class file should be placed in the container which will
81      * be referred by the method getContainerPath.
82      * @return qualified name of the encoding output stream
83      */

84     String JavaDoc getEncoderClassName();
85  
86     /**
87      * Returns the qualified name of the class which should be used
88      * as InputStream in the installer. This class mapps the "real"
89      * decoder or - if useable - the decoder name will be returned self.
90      * If useStandardCompression is true, this method returns null.
91      * @return the qualified name of the class which should be used
92      * as InputStream in the installer
93      */

94     String JavaDoc getDecoderMapperName();
95     /**
96      * Returns whether the standard comression should be used with
97      * this pack compressor or not. If this method returns true,
98      * the returns values of the methods getContainerPath and
99      * getDecoderClassNames are not valid (should be null).
100      * @return whether the standard comression should be used or not
101      */

102     boolean useStandardCompression();
103
104     /**
105      * Receives the current used compiler.
106      * Needed at loading encoder classes and error handling.
107      * @param compiler current active compiler
108      */

109     void setCompiler(Compiler JavaDoc compiler);
110     
111     /**
112      * Returns whether a buffered output stream should be used
113      * intermediate between the output stream of this compressor
114      * and the destination.
115      * @return wether a buffered output stream should be used
116      * intermediate between the output stream of this compressor
117      * and the destination.
118      */

119     boolean needsBufferedOutputStream();
120     
121     /**
122      * Receives the compression level to be used.
123      * @param level compression level to be used
124      */

125     void setCompressionLevel(int level);
126     
127     /**
128      * Returns the compression level to be used.
129      * @return the compression level to be used
130      */

131     int getCompressionLevel();
132     
133     
134     
135 }
136
Popular Tags