Java tutorial
//package com.java2s; import java.io.IOException; import java.io.OutputStream; import java.util.zip.GZIPOutputStream; public class Main { public final static byte GZIP = 1; public static OutputStream buildOutputStream(OutputStream os, byte type) throws IOException { switch (type) { case GZIP: return new GZIPOutputStream(os); default: return os; } } }