Page 1 of 1

Extract json from Zip archive

PostPosted: Thu Jan 24, 2013 4:59 pm
by Illico
For pluzz plugin, I need to extract json information from archive :
http://webservices.francetelevisions.fr ... x_main.zip

How to extract them with groovy plugin ?

Re: Extract json from Zip archive

PostPosted: Thu Jan 24, 2013 6:44 pm
by zip
I have

  Code:
org.serviio.util.ZipUtils.unZipSingleFile(InputStream stream)


But use on your own risk as it's not a shared method and might be renamed/moved in future

Otherwise you can do it manually like this

  Code:
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry = zis.getNextEntry();
if( entry == null ) {
   throw new IOException("Invalid zip file");
}
// now read bytes from the InputStream zis

Re: Extract json from Zip archive

PostPosted: Fri Jan 25, 2013 2:43 pm
by Illico
This will not be easy for me.
I am not a Java developer.
This is a new challenge.
Thanks.

Re: Extract json from Zip archive

PostPosted: Tue Jan 29, 2013 9:47 am
by Illico
It has not been easy, but it works, I create my own method. Will be implemented in the next pluzz.groovy plugin