Global.helma.Zip.extractData (zipData)
extract all files in a ByteArray passed as argument and return them as result Array

  • Parameter Object:
    ByteArray containing the data of the .zip File
  • Returns
    Object instance of helma.Zip.Content
Sourcecode in /home/hannes/helma/modules/helma/Zip.js:
380:   helma.Zip.extractData = function(zipData) {
381:       var zInStream = new java.util.zip.ZipInputStream(new java.io.ByteArrayInputStream(zipData));
382:       var result = new helma.Zip.Content();
383:   
384:       var entry;
385:       while ((entry = zInStream.getNextEntry()) != null) {
386:           var eParam = new helma.Zip.Entry(entry);
387:           if (eParam.isDirectory)
388:               continue;
389:          if (eParam.size == -1)
390:              eParam.size = 16384;
391:          var bos = new java.io.ByteArrayOutputStream(eParam.size);
392:          var buf = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 8192);
393:          var count;
394:          while ((count = zInStream.read(buf)) != -1)
395:              bos.write(buf, 0, count);
396:          eParam.data = bos.toByteArray();
397:          eParam.size = bos.size();
398:          result.add(eParam);
399:      }
400:      zInStream.close();
401:      return result;
402:  }