|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.bolet.jgz.ZlibOutputStream
public class ZlibOutputStream
This class implements a stream which compresses data into the
zlib
format (RFC 1950).
The compression level can be specified, as a symbolic value
identical to what the Deflater
class expects. The
default compression level is MEDIUM
.
Constructor Summary | |
---|---|
ZlibOutputStream(java.io.OutputStream out)
Create the stream with the provided transport stream. |
|
ZlibOutputStream(java.io.OutputStream out,
int level)
Create the stream with the provided transport stream. |
Method Summary | |
---|---|
void |
close()
Close this stream; the transport stream is also closed. |
void |
flush()
Flush this stream; the transport stream is also flushed. |
void |
flushFull(boolean withData)
Flush this stream; the transport stream is also flushed. |
void |
flushPartial()
Flush this stream; the transport stream is also flushed. |
void |
flushSync(boolean withData)
Flush this stream; the transport stream is also flushed. |
void |
processDictionary(byte[] dict)
Process a dictionary: the buffer contents are used as dictionary. |
void |
processDictionary(byte[] dict,
int off,
int len)
Process a dictionary: the buffer contents are used as dictionary. |
void |
processDictionary(java.io.InputStream dict)
Process a dictionary: the stream contents are used as dictionary. |
void |
terminate()
Close the compression stream but do not close the transport stream. |
void |
write(byte[] buf)
|
void |
write(byte[] buf,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZlibOutputStream(java.io.OutputStream out) throws java.io.IOException
MEDIUM
) is used.
out
- the transport stream
java.io.IOException
- on I/O error with the transport streampublic ZlibOutputStream(java.io.OutputStream out, int level) throws java.io.IOException
out
- the transport streamlevel
- the compression level
java.io.IOException
- on I/O error with the transport streamMethod Detail |
---|
public void processDictionary(java.io.InputStream dict) throws java.io.IOException
dict
- the dictionary stream
java.io.IOException
- on I/O error with dict
public void processDictionary(byte[] dict)
dict
- the dictionarypublic void processDictionary(byte[] dict, int off, int len)
dict
- the dictionaryoff
- the dictionary offsetlen
- the dictionary lengthpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
- on I/O error with the transport streampublic void terminate() throws java.io.IOException
gzip
file are written on the transport stream
(but the transport stream itself is not flushed). Note that
gzip
streams are made of several "members" and
there is no indication that a member is the last. Hence, the
receiver will need another way to decide whether this member
is the last.
java.io.IOException
- on I/O error with the transport streampublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- on I/O error with the transport streampublic void flushSync(boolean withData) throws java.io.IOException
withData
.
withData
- false
to omit the 00 00 FF FF bytes
java.io.IOException
- on I/O error with the transport streampublic void flushFull(boolean withData) throws java.io.IOException
withData
.
withData
- false
to omit the 00 00 FF FF bytes
java.io.IOException
- on I/O error with the transport streampublic void flushPartial() throws java.io.IOException
java.io.IOException
- on I/O error with the transport streampublic void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
OutputStream
public void write(byte[] buf) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
OutputStream
public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
OutputStream
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |