Global.helma.Zip.addData (buf, name, level)
adds a new entry to the zip file

  • Parameter Object:
    byte[] containing the data to add
  • Parameter String:
    name of the file to add
  • Parameter Int:
    compression level (0-9, default: 9)
  • Returns
    Boolean true
Sourcecode in /home/hannes/helma/modules/helma/Zip.js:
243:   this.addData = function(buf, name, level) {
244:           var entry = new java.util.zip.ZipEntry(name);
245:           entry.setSize(buf.length);
246:           entry.setTime(new Date());
247:           if (level == null || isNaN(level))
248:               zOutStream.setLevel(9);
249:           else
250:               zOutStream.setLevel(Math.max(0, Math.min(9, parseInt(level, 10))));
251:           zOutStream.putNextEntry(entry);
252:          zOutStream.write(buf, 0, buf.length);
253:          zOutStream.closeEntry();
254:          return true;
255:      }