home *** CD-ROM | disk | FTP | other *** search
- package java.util.zip;
-
- public class Deflater {
- private int strm;
- private byte[] buf;
- private int off;
- private int len;
- private int level;
- private int strategy;
- private boolean setParams;
- private boolean finish;
- private boolean finished;
- public static final int DEFLATED = 8;
- public static final int NO_COMPRESSION = 0;
- public static final int BEST_SPEED = 1;
- public static final int BEST_COMPRESSION = 9;
- public static final int DEFAULT_COMPRESSION = -1;
- public static final int FILTERED = 1;
- public static final int HUFFMAN_ONLY = 2;
- public static final int DEFAULT_STRATEGY = 0;
-
- public Deflater(int var1, boolean var2) {
- this.buf = new byte[0];
- this.level = var1;
- this.strategy = 0;
- this.init(var2);
- }
-
- public Deflater(int var1) {
- this(var1, false);
- }
-
- public Deflater() {
- this(-1, false);
- }
-
- public synchronized void setInput(byte[] var1, int var2, int var3) {
- if (var1 == null) {
- throw new NullPointerException();
- } else if (var2 >= 0 && var3 >= 0 && var2 + var3 <= var1.length) {
- this.buf = var1;
- this.off = var2;
- this.len = var3;
- } else {
- throw new ArrayIndexOutOfBoundsException();
- }
- }
-
- public void setInput(byte[] var1) {
- this.setInput(var1);
- }
-
- public synchronized native void setDictionary(byte[] var1, int var2, int var3);
-
- public void setDictionary(byte[] var1) {
- this.setDictionary(var1, 0, var1.length);
- }
-
- public synchronized void setStrategy(int var1) {
- switch (var1) {
- case 0:
- case 1:
- case 2:
- if (this.strategy != var1) {
- this.strategy = var1;
- this.setParams = true;
- }
-
- return;
- default:
- throw new IllegalArgumentException();
- }
- }
-
- public synchronized void setLevel(int var1) {
- if ((this.level < 0 || this.level > 9) && this.level != -1) {
- throw new IllegalArgumentException("invalid compression level");
- } else {
- if (this.level != this.level) {
- this.level = this.level;
- this.setParams = true;
- }
-
- }
- }
-
- public boolean needsInput() {
- return this.len <= 0;
- }
-
- public synchronized void finish() {
- this.finish = true;
- }
-
- public synchronized boolean finished() {
- return this.finished;
- }
-
- public synchronized native int deflate(byte[] var1, int var2, int var3);
-
- public int deflate(byte[] var1) {
- return this.deflate(var1, 0, var1.length);
- }
-
- public synchronized native int getAdler();
-
- public synchronized native int getTotalIn();
-
- public synchronized native int getTotalOut();
-
- public synchronized native void reset();
-
- public synchronized native void end();
-
- protected void finalize() {
- this.end();
- }
-
- private native void init(boolean var1);
-
- static {
- System.loadLibrary("zip");
- }
- }
-