Code example for GZIPOutputStream

Methods: finish

0
 * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a> 
 */ 
public abstract class GzipContentProducer implements ContentProducer {
    public void writeTo(OutputStream outstream) throws IOException {
        if (GzipOptionalSerializator.isGzipEnabled()) { 
            GZIPOutputStream gzip = new GZIPOutputStream(outstream);
            doWriteTo(gzip);
            gzip.finish();
        } else { 
            doWriteTo(outstream);
        } 
    } 
 
    protected abstract void doWriteTo(OutputStream outstream) throws IOException;
}