1 20 package org.objectweb.modfact.corba.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 37 public void setOutput(OutputStream stream) throws java.io.IOException { 38 out = new ZipOutputStream (stream); 39 } 40 41 protected void writeEntry(String entryName , ByteArrayOutputStream data) throws java.io.IOException { 42 if (data.size()!=0) { 43 ZipEntry entry = new ZipEntry (entryName); 44 out.putNextEntry(entry); 45 out.write( data.toByteArray() , 0 , data.size()); 51 String st = data.toString(); 52 out.closeEntry(); 53 } 55 } 56 } 57 | Popular Tags |