| 1 |
// Copyright 2001-2005, FreeHEP. |
| 2 |
package org.freehep.util.io; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
import java.io.OutputStream; |
| 6 |
import java.util.zip.DeflaterOutputStream; |
| 7 |
|
| 8 |
/** |
| 9 |
* The FlateOutputStream uses the Deflate mechanism to compress data. The exact |
| 10 |
* definition of Deflate encoding can be found in the PostScript Language |
| 11 |
* Reference (3rd ed.) chapter 3.13.3. |
| 12 |
* |
| 13 |
* @author Mark Donszelmann |
| 14 |
* @version $Id: FlateOutputStream.java 8584 2006-08-10 23:06:37Z duns $ |
| 15 |
*/ |
| 16 |
public class FlateOutputStream extends DeflaterOutputStream implements |
| 17 |
FinishableOutputStream { |
| 18 |
|
| 19 |
/** |
| 20 |
* Creates a (In-)Flate output stream. |
| 21 |
* |
| 22 |
* @param out stream to write to |
| 23 |
*/ |
| 24 |
public FlateOutputStream(OutputStream out) { |
| 25 |
super(out); |
| 26 |
} |
| 27 |
|
| 28 |
public void finish() throws IOException { |
| 29 |
super.finish(); |
| 30 |
if (out instanceof FinishableOutputStream) { |
| 31 |
((FinishableOutputStream) out).finish(); |
| 32 |
} |
| 33 |
} |
| 34 |
} |