001 /*
002 Copyright (c) 1996-2011, Damon Hart-Davis
003 All rights reserved.
004
005 Redistribution and use in source and binary forms, with or without
006 modification, are permitted provided that the following conditions are
007 met:
008
009 * Redistributions of source code must retain the above copyright
010 notice, this list of conditions and the following disclaimer.
011
012 * Redistributions in binary form must reproduce the above copyright
013 notice, this list of conditions and the following disclaimer in the
014 documentation and/or other materials provided with the
015 distribution.
016
017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
018 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
019 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
020 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
021 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
022 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
023 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
024 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
025 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
027 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028 */
029 package org.hd.d.pg2k.svrCore;
030
031 /**
032 * Created by IntelliJ IDEA.
033 * User: DHD
034 * Date: 24-Oct-2006
035 * Time: 12:51:57
036 */
037
038 /**A ranked series of compression methods/levels used in PG2K.
039 * This applies to such things as tunnel-frame content
040 * and HTTP transport encodings.
041 * <p>
042 * Higher numeric levels potentially give greater compression
043 * at potentially higher resource cost (especially in the compressor),
044 * though YMMV.
045 * <p>
046 * The order of elements is from lowest to highest compression.
047 */
048 public enum CompressionLevel
049 {
050 /**No compression, thus free to compress/decompress but possibly expensive to store or transmit. */
051 NONE(0),
052
053 /**GZIP/deflate/zlib-style compression; widely used and generally cheap and effective. */
054 ZIP(1),
055
056 /**BZIP2-style compression; more expensive than ZIP (maybe 5x CPU) but more effective on some data sets. */
057 BZIP2(2),
058
059 /**LZMA (7-Zip-style) compression; more expensive than ZIP and less tested, but much more effective on some data sets. */
060 LZMA(3),
061
062 /**PPM compression; very expensive in CPU and memory, but about the best compression available. */
063 PPM(4);
064
065
066 private CompressionLevel(final int level) { this.level = level; }
067
068 /**The "level", higher meaning generally better and more expensive; 0 indicates none. */
069 private final int level;
070
071 /**Get the "level", higher meaning generally better and more expensive; 0 indicates none. */
072 public final int getLevel() { return(level); }
073 }