|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.bolet.jgz.GZipOutputStream
public class GZipOutputStream
This class represents a stream which compress data into the
gzip
format, as specified in RFC 1952.
gzip
streams contain meta-information in various
fields, some of which being optional. This class class sets these
fields to default, rather uninformative values: the OS field is set
to 255 ("unknown"), the original file name is not included, and the
original file modification time is set to 0. These values are legal,
according to RFC 1952, and almost no application uses these fields
anyway.
The compression level can be specified, as a symbolic value
identical to what the Deflater
class expects. The
default compression level is MEDIUM
.
Since compression is inherently buffered, the provided stream needs not feature buffers.
Constructor Summary | |
---|---|
GZipOutputStream(java.io.OutputStream out)
Create the stream with the provided transport stream. |
|
GZipOutputStream(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 |
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 GZipOutputStream(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 GZipOutputStream(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 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 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 |