1
|
package io;
|
2
|
|
3
|
import java.io.FilterInputStream;
|
4
|
import java.io.IOException;
|
5
|
import java.io.InputStream;
|
6
|
import java.util.zip.Inflater;
|
7
|
import java.util.zip.InflaterInputStream;
|
8
|
|
9
|
public class InflaterInStream extends FilterInputStream implements IZipReader {
|
10
|
|
11
|
private Inflater inflater;
|
12
|
|
13
|
public InflaterInStream(InputStream in) {
|
14
|
super(null);
|
15
|
inflater = new Inflater();
|
16
|
this.in = new InflaterInputStream(in, inflater);
|
17
|
}
|
18
|
|
19
|
public int read() throws IOException {
|
20
|
return in.read();
|
21
|
}
|
22
|
|
23
|
public void close() throws IOException {
|
24
|
try {
|
25
|
super.close();
|
26
|
}
|
27
|
finally {
|
28
|
if (inflater != null) {
|
29
|
inflater.end();
|
30
|
}
|
31
|
}
|
32
|
}
|
33
|
|
34
|
}
|