code: public static byte[] encode(final byte[] data) throws IOException {
          ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
          GZIPOutputStream gzOut = null;
          try {
              gzOut = new GZIPOutputStream(byteOut);
              gzOut.write(data);
              gzOut.close();
              byteOut.close();
              return byteOut.toByteArray();
          } finally {
              gzOut.close();
              byteOut.close();
          }
      }
docs: Compress/encode the data provided using the GZIP format.
  
  @param data data to compress
  @return compressed data
  @throws IOException on compression failure