📄 switchinflater.java
字号:
/* * Java core library component. * * Copyright (c) 1997, 1998 * Transvirtual Technologies, Inc. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */package org.kaffe.util.zip;import java.util.zip.DataFormatException;import java.util.zip.Inflater;public class SwitchInflater extends Inflater { private int maxlen; private boolean stored; public SwitchInflater(boolean nowrap, boolean stored) { super(nowrap); this.stored = stored; } public SwitchInflater() { this(false, false); } public synchronized void setInput(byte b[], int o, int l) { super.setInput(b, o, l); } public synchronized boolean needsInput() { if (stored) { return (len > 0 ? false : true); } else { return super.needsInput(); } } public synchronized boolean finished() { if (stored) { return (maxlen > 0 ? false : true); } else { return super.finished(); } } public synchronized int inflate(byte b[], int o, int l) throws DataFormatException { if (stored) { /* Special case: len may be zero */ if (len == 0) return 0; if (l >= maxlen) { l = maxlen; } if (l >= len) { l = len; } System.arraycopy(buf, off, b, o, l); off += l; len -= l; maxlen -= l; } else { l = super.inflate(b, o, l); } return (l); } public synchronized void reset() { int olen = len; super.reset(); len = olen; } public synchronized void setMode(boolean stored) { this.stored = stored; } public synchronized void setLength(int len) { this.maxlen = len; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -