1 20 package org.objectweb.modfact.jmi.generator; 21 22 import java.io.ByteArrayOutputStream ; 23 import java.io.OutputStream ; 24 import java.util.zip.ZipEntry ; 25 import java.util.zip.ZipOutputStream ; 26 27 30 public abstract class ZipGenerator implements Generator { 31 32 protected ZipOutputStream out; 33 34 35 public void setOutput(OutputStream stream) throws java.io.IOException { 36 out = new ZipOutputStream (stream); 37 } 38 39 protected void writeEntry(String entryName , ByteArrayOutputStream data) throws java.io.IOException { 40 if (data.size()!=0) { 41 ZipEntry entry = new ZipEntry (entryName); 42 out.putNextEntry(entry); 43 44 out.write( data.toByteArray() , 0 , data.size()); 45 String st = data.toString(); 46 out.closeEntry(); 47 } 48 } 49 } 50 | Popular Tags |