|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream tribble.io.InflaterOutputStream
public class InflaterOutputStream
Implements an output stream filter for uncompressing data stored in the "deflate" compression format.
This class serves as a complement to the standard java.util.zip.InflaterInputStream and java.util.zip.DeflaterOutputStream classes. It decompresses ("inflates") data like the former class, but writes the decompressed data to an output stream like the latter class.
Copyright ©2005 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source
code provided that the original copyright and authorship notices
remain intact.
DeflaterInputStream
,
DeflaterOutputStream
,
InflaterInputStream
,
java.util.zip.InflaterOutputStream
Field Summary | |
---|---|
protected byte[] |
m_buf
Output buffer for writing compressed data. |
protected long |
m_inBytes
Total bytes written to this output stream. |
protected java.util.zip.Inflater |
m_infl
Decompressor for this stream. |
protected long |
m_outBytes
Total bytes written to the underlying output stream. |
(package private) static java.lang.String |
REV
Revision information. |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
InflaterOutputStream(java.io.OutputStream out)
Construct a new output stream with a default decompressor and buffer size. |
|
InflaterOutputStream(java.io.OutputStream out,
java.util.zip.Inflater infl)
Construct a new output stream with the specified decompressor and a default buffer size. |
|
InflaterOutputStream(java.io.OutputStream out,
java.util.zip.Inflater infl,
int bufLen)
Construct a new output stream with the specified decompressor and buffer size. |
Method Summary | |
---|---|
void |
close()
Write any remaining uncompressed data to this output stream and close the underlying output stream. |
protected void |
finalize()
Finalization. |
void |
finish()
Finish writing uncompressed data to this output stream. |
void |
flush()
Flush this output stream, forcing any buffered output bytes to be written to the stream. |
long |
getTotalIn()
Determine the total number of bytes written to this decompressed output stream. |
long |
getTotalOut()
Determine the total number of bytes written to the underlying output stream. |
static void |
main(java.lang.String[] args)
Uncompress a file containing data stored in the "deflate" compression format. |
void |
write(byte[] buf)
Write data to this uncompressed output stream. |
void |
write(byte[] buf,
int off,
int len)
Write data to this uncompressed output stream. |
void |
write(int b)
Write data to this uncompressed output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String REV
protected java.util.zip.Inflater m_infl
protected byte[] m_buf
protected long m_inBytes
protected long m_outBytes
Constructor Detail |
---|
public InflaterOutputStream(java.io.OutputStream out)
out
- Output stream to write the uncompressed data to.public InflaterOutputStream(java.io.OutputStream out, java.util.zip.Inflater infl)
out
- Output stream to write the uncompressed data to.infl
- Decompressor ("inflater") for this stream.public InflaterOutputStream(java.io.OutputStream out, java.util.zip.Inflater infl, int bufLen)
out
- Output stream to write the uncompressed data to.infl
- Decompressor ("inflater") for this stream.bufLen
- Decompression buffer size.
java.lang.NullPointerException
- (unchecked)
Thrown if out or infl is null.
java.lang.IllegalArgumentException
- (unchecked)
Thrown if bufLen is less than 1.Method Detail |
---|
public static void main(java.lang.String[] args) throws java.lang.Exception
The file to be uncompressed should contain compressed data stored in the
"deflate" compression format, such as the output from the
DeflaterInputStream
class.
Usage
java tribble.io.InflaterOutputStream [-option...] file
Options
args
- Command line arguments.
java.lang.Exception
DeflaterInputStream.main()
public void close() throws java.io.IOException
Note that this method can be called multiple times with no ill effects.
close
in interface java.io.Closeable
close
in class java.io.FilterOutputStream
java.io.IOException
- Thrown if an I/O error occurs.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
- Thrown if an I/O error occurs.
java.lang.NullPointerException
- (unchecked)
Thrown if the output stream is closed.public void finish() throws java.io.IOException
java.io.IOException
- Thrown if an I/O error occurs.
java.lang.NullPointerException
- (unchecked)
Thrown if the output stream is closed.flush()
,
close()
public void write(int b) throws java.io.IOException
write
in class java.io.FilterOutputStream
b
- A single byte of compresses data to decompress and write to the output
stream.
java.util.zip.ZipException
- Thrown if a compression (ZIP) format error occurs.
java.io.IOException
- Thrown if an I/O error occurs.
java.lang.NullPointerException
- (unchecked)
Thrown if the output stream is closed.public void write(byte[] buf) throws java.io.IOException
write
in class java.io.FilterOutputStream
buf
- Buffer containing compressed data to decompress and write to the output
stream.
java.util.zip.ZipException
- Thrown if a compression (ZIP) format error occurs.
java.io.IOException
- Thrown if an I/O error occurs.
java.lang.NullPointerException
- (unchecked)
Thrown if the output stream is closed.public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
buf
- Buffer containing compressed data to decompress and write to the output
stream.off
- Starting offset of the compressed data within buf.len
- Number of bytes to decompress from buf.
java.util.zip.ZipException
- Thrown if a compression (ZIP) format error occurs.
java.io.IOException
- Thrown if an I/O error occurs.
java.lang.NullPointerException
- (unchecked)
Thrown if the output stream is closed.public long getTotalIn()
public long getTotalOut()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |