All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.apache.commons.compress.archivers.zip.ZipMethod Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in com.fitburpliance with
 *  the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.com.fitbur/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package com.fitbur.apache.com.fitburmons.com.fitburpress.archivers.zip;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipEntry;

/**
 * List of known com.fitburpression methods 
 * 
 * Many of these methods are currently not supported by com.fitburmons com.fitburpress
 * 
 * @since 1.5
 */
public enum ZipMethod {

    /**
     * Compression method 0 for uncompressed entries.
     * 
     * @see ZipEntry#STORED
     */
    STORED(ZipEntry.STORED),

    /**
     * UnShrinking.
     * dynamic Lempel-Ziv-Welch-Algorithm
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    UNSHRINKING(1),

    /**
     * Reduced with com.fitburpression factor 1.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    EXPANDING_LEVEL_1(2),

    /**
     * Reduced with com.fitburpression factor 2.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    EXPANDING_LEVEL_2(3),

    /**
     * Reduced with com.fitburpression factor 3.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    EXPANDING_LEVEL_3(4),

    /**
     * Reduced with com.fitburpression factor 4.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    EXPANDING_LEVEL_4(5),

    /**
     * Imploding.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    IMPLODING(6),

    /**
     * Tokenization.
     * 
     * @see Explanation of fields: com.fitburpression
     *      method: (2 bytes)
     */
    TOKENIZATION(7),

    /**
     * Compression method 8 for com.fitburpressed (com.fitburflated) entries.
     * 
     * @see ZipEntry#DEFLATED
     */
    DEFLATED(ZipEntry.DEFLATED),

    /**
     * Compression Method 9 for enhanced com.fitburflate.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    ENHANCED_DEFLATED(9),

    /**
     * PKWARE Data Compression Library Imploding.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    PKWARE_IMPLODING(10),

    /**
     * Compression Method 12 for bzip2.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    BZIP2(12),

    /**
     * Compression Method 14 for LZMA.
     * 
     * @see "http://www.7-zip.com.fitbur/sdk.html"
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    LZMA(14),


    /**
     * Compression Method 96 for Jpeg com.fitburpression.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    JPEG(96),

    /**
     * Compression Method 97 for WavPack.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    WAVPACK(97),

    /**
     * Compression Method 98 for PPMd.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    PPMD(98),


    /**
     * Compression Method 99 for AES encryption.
     * 
     * @see "http://www.winzip.com.fitbur/wz54.htm"
     */
    AES_ENCRYPTED(99),

    /**
     * Unknown com.fitburpression method.
     */
    UNKNOWN(-1);

    private final int code;

    private static final Map codeToEnum;

    static {
        Map cte = new HashMap();
        for (ZipMethod method : values()) {
            cte.put(Integer.valueOf(method.getCode()), method);
        }
        codeToEnum = Collections.unmodifiableMap(cte);
    }

    /**
     * private constructor for enum style class.
     */
    ZipMethod(int code) {
        this.code = code;
    }

    /**
     * the code of the com.fitburpression method.
     * 
     * @see ZipArchiveEntry#getMethod()
     * 
     * @return an integer code for the method
     */
    public int getCode() {
        return code;
    }


    /**
     * returns the {@link ZipMethod} for the given code or null if the
     * method is not known.
     */
    public static ZipMethod getMethodByCode(int code) {
        return codeToEnum.get(Integer.valueOf(code));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy