001/*
002 * $Id: BZip2PackCompressor.java,v 1.2 2005/08/26 11:22:53 bartzkau Exp $
003 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
004 * 
005 * http://www.izforge.com/izpack/
006 * http://developer.berlios.de/projects/izpack/
007 * 
008 * Copyright 2005 Klaus Bartz
009 *
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *     http://www.apache.org/licenses/LICENSE-2.0
015 *     
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 */
022package com.izforge.izpack.compressor;
023
024import java.io.OutputStream;
025
026
027/**
028 * IzPack will be able to support different compression methods for the
029 * packs included in the installation jar file.
030 * This class implements the PackCompressor for the compression format "bzip2".
031 * 
032 * @author Klaus Bartz
033 */
034public class BZip2PackCompressor extends PackCompressorBase
035{
036
037    private static final String [] THIS_FORMAT_NAMES = {"bzip2"};
038    private static final String [] THIS_CONTAINER_PATH = {"lib/ant.jar"};
039    private static final String THIS_DECODER_MAPPER = "org.apache.tools.bzip2.CBZip2InputStream";
040    private static final String [][] THIS_DECODER_CLASS_NAMES = 
041        {{ "org.apache.tools.bzip2.BZip2Constants.*" ,
042          "org.apache.tools.bzip2.CBZip2InputStream.*",
043          "org.apache.tools.bzip2.CRC.*"
044        }};
045    private static final String THIS_ENCODER_CLASS_NAME = "org.apache.tools.bzip2.CBZip2OutputStream";
046
047    /**
048     * 
049     */
050    public BZip2PackCompressor()
051    {
052        super();
053        formatNames = THIS_FORMAT_NAMES;
054        containerPaths = THIS_CONTAINER_PATH;
055        decoderMapper = THIS_DECODER_MAPPER;
056        decoderClassNames = THIS_DECODER_CLASS_NAMES;
057        encoderClassName = THIS_ENCODER_CLASS_NAME;
058    }
059
060    /* (non-Javadoc)
061     * @see com.izforge.izpack.compressor.PackCompressor#getOutputStream(java.io.OutputStream)
062     */
063    public OutputStream getOutputStream(OutputStream os) throws Exception
064    {
065        // TODO Auto-generated method stub
066        
067        return( getOutputInstance(os));
068    }
069
070}