com.izforge.izpack.compressor
Interface PackCompressor

All Known Implementing Classes:
PackCompressorBase

public interface PackCompressor

IzPack will be able to support different compression methods for the packs included in the installation jar file. This interface declares the handler of one compression format.

Author:
Klaus Bartz

Method Summary
 java.lang.String[] getCompressionFormatSymbols()
          Returns all symbolic names which are used for this compressor.
 int getCompressionLevel()
          Returns the compression level to be used.
 java.lang.String[] getContainerPaths()
          Returns the path where the compiler can find the classes; normaly this is a path to a jar file.
 java.lang.String[][] getDecoderClassNames()
          Returns the qualified names of all needed classes for decoding.
 java.lang.String getDecoderMapperName()
          Returns the qualified name of the class which should be used as InputStream in the installer.
 java.lang.String getEncoderClassName()
          Returns the qualified name of the encoding output stream.
 java.io.OutputStream getOutputStream(java.io.OutputStream os)
          Returns a newly created output stream which write method writes the given input encoded to the defined output stream.
 boolean needsBufferedOutputStream()
          Returns whether a buffered output stream should be used intermediate between the output stream of this compressor and the destination.
 void setCompiler(Compiler compiler)
          Receives the current used compiler.
 void setCompressionLevel(int level)
          Receives the compression level to be used.
 boolean useStandardCompression()
          Returns whether the standard comression should be used with this pack compressor or not.
 

Method Detail

getOutputStream

public java.io.OutputStream getOutputStream(java.io.OutputStream os)
                                     throws java.lang.Exception
Returns a newly created output stream which write method writes the given input encoded to the defined output stream. Attention! This method will be returned a valid output stream only if it is used in the IzPack compiler, or if this pack compressor needs no external classes. A call in the installation should be throw if external classes are used. The implementation should load the needed classes via reflection because classes are not present in the installation.

Parameters:
os - output stream to be used as listener
Returns:
a newly created encoding output stream
Throws:
java.lang.Exception

getCompressionFormatSymbols

public java.lang.String[] getCompressionFormatSymbols()
Returns all symbolic names which are used for this compressor.

Returns:
all symbolic names which are used for this compressor

getContainerPaths

public java.lang.String[] getContainerPaths()
Returns the path where the compiler can find the classes; normaly this is a path to a jar file. If no additional classes are needed, this method should return null.

Returns:
the path where the compiler can find the classes

getDecoderClassNames

public java.lang.String[][] getDecoderClassNames()
Returns the qualified names of all needed classes for decoding. All class files should be placed in the container which will be referred by the method getContainerPath. If no additional classes are needed, this method should return null.

Returns:
qualified names of all needed classes for decoding

getEncoderClassName

public java.lang.String getEncoderClassName()
Returns the qualified name of the encoding output stream. The class file should be placed in the container which will be referred by the method getContainerPath.

Returns:
qualified name of the encoding output stream

getDecoderMapperName

public java.lang.String getDecoderMapperName()
Returns the qualified name of the class which should be used as InputStream in the installer. This class mapps the "real" decoder or - if useable - the decoder name will be returned self. If useStandardCompression is true, this method returns null.

Returns:
the qualified name of the class which should be used as InputStream in the installer

useStandardCompression

public boolean useStandardCompression()
Returns whether the standard comression should be used with this pack compressor or not. If this method returns true, the returns values of the methods getContainerPath and getDecoderClassNames are not valid (should be null).

Returns:
whether the standard comression should be used or not

setCompiler

public void setCompiler(Compiler compiler)
Receives the current used compiler. Needed at loading encoder classes and error handling.

Parameters:
compiler - current active compiler

needsBufferedOutputStream

public boolean needsBufferedOutputStream()
Returns whether a buffered output stream should be used intermediate between the output stream of this compressor and the destination.

Returns:
wether a buffered output stream should be used intermediate between the output stream of this compressor and the destination.

setCompressionLevel

public void setCompressionLevel(int level)
Receives the compression level to be used.

Parameters:
level - compression level to be used

getCompressionLevel

public int getCompressionLevel()
Returns the compression level to be used.

Returns:
the compression level to be used