|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.jcraft.jzlib.ZOutputStream
public class ZOutputStream
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
|
protected byte[] |
buf1
A one-byte buffer, used by write(int) . |
protected int |
bufsize
|
protected boolean |
compress
|
protected int |
flush
|
protected OutputStream |
out
The underlying output stream. |
protected ZStream |
z
|
Constructor Summary | |
---|---|
ZOutputStream(OutputStream out)
Creates a new decompressing (inflating) ZOutputStream. |
|
ZOutputStream(OutputStream out,
int level)
Creates a new compressing (deflating) ZOutputStream. |
|
ZOutputStream(OutputStream out,
int level,
boolean nowrap)
Creates a new compressing (deflating) ZOutputStream. |
Method Summary | |
---|---|
void |
close()
Closes the stream. |
void |
end()
Cleans up the deflater/inflater state. |
void |
finish()
Finishes the compressing/decompressing, without closing the underlying stream. |
void |
flush()
flushes the underlying stream. |
int |
getFlushMode()
Returns the current flush mode, which will be used for every write(int) . |
long |
getTotalIn()
Returns the total number of bytes input so far. |
long |
getTotalOut()
Returns the total number of bytes output so far. |
void |
setFlushMode(int flush)
Sets the flush mode. |
void |
write(byte[] b,
int off,
int len)
Writes a sequence of bytes, compressing or decompressing it. |
void |
write(int b)
Writes a single byte. |
Methods inherited from class java.io.OutputStream |
---|
write |
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
protected int flush
protected byte[] buf
protected byte[] buf1
write(int)
.
protected boolean compress
protected OutputStream out
Constructor Detail |
---|
public ZOutputStream(OutputStream out)
public ZOutputStream(OutputStream out, int level)
out
- the stream that will receive the compressed
data.level
- the deflation level. This should be
Z_NO_COMPRESSION
,
Z_DEFAULT_COMPRESSION
or a
value between Z_BEST_SPEED
(1) and
Z_BEST_COMPRESSION
(9) (both inclusive).public ZOutputStream(OutputStream out, int level, boolean nowrap)
out
- the stream that will receive the compressed
data.level
- the deflation level. This should be
Z_NO_COMPRESSION
,
Z_DEFAULT_COMPRESSION
or a
value between Z_BEST_SPEED
(1) and
Z_BEST_COMPRESSION
(9) (both inclusive).nowrap
- if true
, the stream uses the plain deflate
format. If false
, the stream uses the zlib
format
(which includes a header and checksum).Method Detail |
---|
public void write(int b) throws IOException
write(new byte[]{b},0,1)
(but reusing the array for multiple calls).
write
in class OutputStream
b
- the byte to write.
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
b
- the array holding the dataoff
- the offset in b
where the data starts.len
- the length of the data.
IOException
public int getFlushMode()
write(int)
.
public void setFlushMode(int flush)
write(int)
.
public void finish() throws IOException
IOException
public void end()
close()
.
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
public long getTotalIn()
public long getTotalOut()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |