|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
com.jcraft.jzlib.ZInputStream
public class ZInputStream
An output stream wrapper around a ZStream
.
This can work either as a deflating or inflating stream,
depending on the constructor being used.
Field Summary | |
---|---|
protected byte[] |
buf
The internal buffer used for reading the original stream and passing input to the ZStream. |
protected byte[] |
buf1
A one-byte buffer, used by read() . |
protected int |
bufsize
The size of our internal buffer buf . |
protected boolean |
compress
Wether we are inflating (false) or deflating (true). |
protected int |
flush
The flushing mode in use. |
protected InputStream |
in
The source input stream. |
protected ZStream |
z
The wrapped ZStream, which does the work. |
Constructor Summary | |
---|---|
ZInputStream(InputStream in)
Creates a new decompressing (inflating) ZInputStream reading zlib formatted data. |
|
ZInputStream(InputStream in,
boolean nowrap)
Creates a new decompressing (inflating) ZInputStream, reading either zlib or plain deflate data. |
|
ZInputStream(InputStream in,
int level)
Creates a compressing (deflating) ZInputStream, producing zlib format data. |
Method Summary | |
---|---|
void |
close()
Closes this stream. |
int |
getFlushMode()
Returns the current flush mode used for each compressing/decompressing call. |
long |
getTotalIn()
Returns the total number of bytes input so far. |
long |
getTotalOut()
Returns the total number of bytes output so far. |
int |
read()
Reads one byte of data. |
int |
read(byte[] b,
int off,
int len)
reads some data from the stream. |
void |
setFlushMode(int flush)
Returns the current flush mode used for each compressing/decompressing call. |
long |
skip(long n)
skips some amount of (compressed or decompressed) input. |
Methods inherited from class java.io.FilterInputStream |
---|
available, mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ZStream z
protected int bufsize
buf
.
protected int flush
protected byte[] buf
protected byte[] buf1
read()
.
protected boolean compress
protected InputStream in
Constructor Detail |
---|
public ZInputStream(InputStream in)
in
- the base stream, which should contain data in
zlib format.public ZInputStream(InputStream in, boolean nowrap)
in
- the base stream, which should contain data
in the right format.nowrap
- if true, the input is plain deflate data.
If false, it is in zlib format (i.e. with a small header
and a checksum).public ZInputStream(InputStream in, int level)
in
- the base stream from which to read uncompressed data.level
- the compression level which will be used.Method Detail |
---|
public int read() throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
b
- the buffer in which to put the data.off
- the offset in b on which we should
put the data.len
- how much data to read maximally.
IOException
public long skip(long n) throws IOException
skip
in class FilterInputStream
IOException
public int getFlushMode()
Z_NO_FLUSH
.
public void setFlushMode(int flush)
Z_NO_FLUSH
.
public long getTotalIn()
public long getTotalOut()
public void close() throws IOException
close
in interface Closeable
close
in class FilterInputStream
IOException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |