org.freehep.util.io
Class CompressableOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.freehep.util.io.CompressableOutputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, FinishableOutputStream
- Direct Known Subclasses:
- BitOutputStream
public class CompressableOutputStream extends java.io.FilterOutputStream implements FinishableOutputStream
Special stream that can be used to write a header in uncompressed format, and the rest of the stream in compressed format. This stream is used by SWF, to compress the tail of the stream.
-
-
Constructor Summary
Constructors Constructor and Description CompressableOutputStream(java.io.OutputStream out)Creates a Compressable Output Stream from given stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()voidfinish()Finishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.voidstartCompressing()Start compressing from the next byte onwards.voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
CompressableOutputStream
public CompressableOutputStream(java.io.OutputStream out)
Creates a Compressable Output Stream from given stream. Initially the stream does not compress.- Parameters:
out- stream to write to
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionDescription copied from interface:FinishableOutputStreamFinishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.- Specified by:
finishin interfaceFinishableOutputStream- Throws:
java.io.IOException- if write fails
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
startCompressing
public void startCompressing() throws java.io.IOExceptionStart compressing from the next byte onwards. Flushes what is currently in the buffer to the underlying stream and start compression from here.- Throws:
java.io.IOException- if write fails
-
-
DMelt 3.0 © DataMelt by jWork.ORG