How to use a Data Process to gunzip a file?

Document created by anton_serbanescu Employee on Feb 27, 2014
Version 1Show Document
  • View in full screen mode
I have a process where I need to pick up a file and compress it before it gets to the cloud. Then I need to use a Data Process
to uncompress the same file and start processing the file. How do I accomplish the uncompressing using a  Data Process do
the trick ?


Original file is 220 K

I need to have the file size under 40K

Process will execute every minute.



0EM40000000PWIp
Configure the Data Process shape, and choose Custom Scripting. Use Groovy and here is the
sample Groovy script:

import java.util.Properties;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

for( int i = 0; i < dataContext.getDataCount(); i++ )
   {
      InputStream is = dataContext.getStream(i);
      GZIPInputStream gin = new GZIPInputStream(is);
      Properties props = dataContext.getProperties(i);
     dataContext.storeStream(gin, props);
 }
2 people found this helpful

Attachments

    Outcomes