Method from java.util.zip.InflaterInputStream Detail: |
public int available() throws IOException {
ensureOpen();
if (reachEOF) {
return 0;
} else {
return 1;
}
}
Returns 0 after EOF has been reached, otherwise always return 1.
Programs should not count on this method to return the actual number
of bytes that could be read without blocking. |
public void close() throws IOException {
if (!closed) {
if (usesDefaultInflater)
inf.end();
in.close();
closed = true;
}
}
Closes this input stream and releases any system resources associated
with the stream. |
protected void fill() throws IOException {
ensureOpen();
len = in.read(buf, 0, buf.length);
if (len == -1) {
throw new EOFException("Unexpected end of ZLIB input stream");
}
inf.setInput(buf, 0, len);
}
Fills input buffer with more data to decompress. |
public synchronized void mark(int readlimit) {
}
|
public boolean markSupported() {
return false;
}
Tests if this input stream supports the mark and
reset methods. The markSupported
method of InflaterInputStream returns
false . |
public int read() throws IOException {
ensureOpen();
return read(singleByteBuf, 0, 1) == -1 ? -1 : singleByteBuf[0] & 0xff;
}
Reads a byte of uncompressed data. This method will block until
enough input is available for decompression. |
public int read(byte[] b,
int off,
int len) throws IOException {
ensureOpen();
if (b == null) {
throw new NullPointerException();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
try {
int n;
while ((n = inf.inflate(b, off, len)) == 0) {
if (inf.finished() || inf.needsDictionary()) {
reachEOF = true;
return -1;
}
if (inf.needsInput()) {
fill();
}
}
return n;
} catch (DataFormatException e) {
String s = e.getMessage();
throw new ZipException(s != null ? s : "Invalid ZLIB data format");
}
}
Reads uncompressed data into an array of bytes. If len is not
zero, the method will block until some input can be decompressed; otherwise,
no bytes are read and 0 is returned. |
public synchronized void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
|
public long skip(long n) throws IOException {
if (n < 0) {
throw new IllegalArgumentException("negative skip length");
}
ensureOpen();
int max = (int)Math.min(n, Integer.MAX_VALUE);
int total = 0;
while (total < max) {
int len = max - total;
if (len > b.length) {
len = b.length;
}
len = read(b, 0, len);
if (len == -1) {
reachEOF = true;
break;
}
total += len;
}
return total;
}
Skips specified number of bytes of uncompressed data. |