package com.bbn.bue.common.io;

import com.google.common.io.ByteSink;

import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

import static com.google.common.base.Preconditions.checkNotNull;

public final class GZIPByteSink extends ByteSink {

  private GZIPByteSink(final ByteSink wrappedByteSink) {
    this.wrappedByteSink = checkNotNull(wrappedByteSink);
  }

  public static ByteSink gzipCompress(final ByteSink byteSink) {
    return new GZIPByteSink(byteSink);
  }

  @Override
  public OutputStream openStream() throws IOException {
    return new GZIPOutputStream(wrappedByteSink.openBufferedStream());
  }

  private final ByteSink wrappedByteSink;
}

@@ -63,16 +63,72 @@
 teSink;%0A
+import com.google.common.io.Files;%0A%0Aimport java.io.File;
 %0Aimport 
@@ -564,16 +564,121 @@
 );%0A  %7D%0A%0A
+  public static ByteSink gzipCompress(final File f) %7B%0A    return gzipCompress(Files.asByteSink(f));%0A  %7D%0A%0A
   @Overr

Make GZIPByteSink from a file easily