comparison src/com/jcraft/jzlib/JZlib.java @ 357:46c2115ae1c8

update jzlib to a21be20213d66eff15904d925e9b721956a01ef7
author Carl Byington <carl@five-ten-sg.com>
date Fri, 01 Aug 2014 13:34:58 -0700
parents 0ce5cc452d02
children
comparison
equal deleted inserted replaced
356:5e91b559b5fe 357:46c2115ae1c8
1 /* -*-mode:java; c-basic-offset:2; -*- */ 1 /* -*-mode:java; c-basic-offset:2; -*- */
2 /* 2 /*
3 Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved. 3 Copyright (c) 2011 ymnk, JCraft,Inc. All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met: 6 modification, are permitted provided that the following conditions are met:
7 7
8 1. Redistributions of source code must retain the above copyright notice, 8 1. Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer. 9 this list of conditions and the following disclaimer.
10 10
11 2. Redistributions in binary form must reproduce the above copyright 11 2. Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in 12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the distribution. 13 the documentation and/or other materials provided with the distribution.
14 14
15 3. The names of the authors may not be used to endorse or promote products 15 3. The names of the authors may not be used to endorse or promote products
16 derived from this software without specific prior written permission. 16 derived from this software without specific prior written permission.
17 17
32 * and contributors of zlib. 32 * and contributors of zlib.
33 */ 33 */
34 34
35 package com.jcraft.jzlib; 35 package com.jcraft.jzlib;
36 36
37 final public class JZlib { 37 final public class JZlib{
38 private static final String version = "1.0.2"; 38 private static final String version="1.1.0";
39 public static String version() {return version;} 39 public static String version(){return version;}
40 40
41 // compression levels 41 static final public int MAX_WBITS=15; // 32K LZ77 window
42 static final public int Z_NO_COMPRESSION = 0; 42 static final public int DEF_WBITS=MAX_WBITS;
43 static final public int Z_BEST_SPEED = 1;
44 static final public int Z_BEST_COMPRESSION = 9;
45 static final public int Z_DEFAULT_COMPRESSION = (-1);
46 43
47 // compression strategy 44 public enum WrapperType {
48 static final public int Z_FILTERED = 1; 45 NONE, ZLIB, GZIP, ANY
49 static final public int Z_HUFFMAN_ONLY = 2; 46 }
50 static final public int Z_DEFAULT_STRATEGY = 0;
51 47
52 static final public int Z_NO_FLUSH = 0; 48 public static final WrapperType W_NONE = WrapperType.NONE;
53 static final public int Z_PARTIAL_FLUSH = 1; 49 public static final WrapperType W_ZLIB = WrapperType.ZLIB;
54 static final public int Z_SYNC_FLUSH = 2; 50 public static final WrapperType W_GZIP = WrapperType.GZIP;
55 static final public int Z_FULL_FLUSH = 3; 51 public static final WrapperType W_ANY = WrapperType.ANY;
56 static final public int Z_FINISH = 4;
57 52
58 static final public int Z_OK = 0; 53 // compression levels
59 static final public int Z_STREAM_END = 1; 54 static final public int Z_NO_COMPRESSION=0;
60 static final public int Z_NEED_DICT = 2; 55 static final public int Z_BEST_SPEED=1;
61 static final public int Z_ERRNO = -1; 56 static final public int Z_BEST_COMPRESSION=9;
62 static final public int Z_STREAM_ERROR = -2; 57 static final public int Z_DEFAULT_COMPRESSION=(-1);
63 static final public int Z_DATA_ERROR = -3; 58
64 static final public int Z_MEM_ERROR = -4; 59 // compression strategy
65 static final public int Z_BUF_ERROR = -5; 60 static final public int Z_FILTERED=1;
66 static final public int Z_VERSION_ERROR = -6; 61 static final public int Z_HUFFMAN_ONLY=2;
62 static final public int Z_DEFAULT_STRATEGY=0;
63
64 static final public int Z_NO_FLUSH=0;
65 static final public int Z_PARTIAL_FLUSH=1;
66 static final public int Z_SYNC_FLUSH=2;
67 static final public int Z_FULL_FLUSH=3;
68 static final public int Z_FINISH=4;
69
70 static final public int Z_OK=0;
71 static final public int Z_STREAM_END=1;
72 static final public int Z_NEED_DICT=2;
73 static final public int Z_ERRNO=-1;
74 static final public int Z_STREAM_ERROR=-2;
75 static final public int Z_DATA_ERROR=-3;
76 static final public int Z_MEM_ERROR=-4;
77 static final public int Z_BUF_ERROR=-5;
78 static final public int Z_VERSION_ERROR=-6;
79
80 // The three kinds of block type
81 static final public byte Z_BINARY = 0;
82 static final public byte Z_ASCII = 1;
83 static final public byte Z_UNKNOWN = 2;
84
85 public static long adler32_combine(long adler1, long adler2, long len2){
86 return Adler32.combine(adler1, adler2, len2);
87 }
88
89 public static long crc32_combine(long crc1, long crc2, long len2){
90 return CRC32.combine(crc1, crc2, len2);
91 }
67 } 92 }