@Override
  public Data process(Data context) throws ProcessingStageException {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();

    try (GZIPOutputStream stream = new GZIPOutputStream(buffer)) {
      stream.write(context.getContent().getImmutableArray(), 0, context.getContent().size());
      stream.close();
    } catch (IOException e) {
      throw new ProcessingStageException(e);
    }

    context.setContent(new Blob(buffer.toByteArray()));
    return context;
  }
@ Override public Data process ( Data context ) throws ProcessingStageException { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; try ( GZIPOutputStream stream = new GZIPOutputStream ( buffer ) ) { stream . write ( context . getContent ( ) . getImmutableArray ( ) , 0 , context . getContent ( ) . size ( ) ) ; stream . close ( ) ; } catch ( IOException e ) { throw new ProcessingStageException ( e ) ; } context . setContent ( new Blob ( buffer . toByteArray ( ) ) ) ; return context ; }
Compress and replace the {@link Data} content. Note: this stage will return
the same {@link Data} instance and will modify only its content.

@param context the {@link Data} packet
@return the same packet but with GZIP-compressed content
@throws ProcessingStageException if compression fails