1 18 19 package org.apache.tools.ant.taskdefs; 20 21 22 import java.io.BufferedOutputStream ; 23 import java.io.FileOutputStream ; 24 import java.io.IOException ; 25 import org.apache.tools.ant.BuildException; 26 import org.apache.tools.ant.util.FileUtils; 27 import org.apache.tools.bzip2.CBZip2OutputStream; 28 29 37 38 public class BZip2 extends Pack { 39 42 protected void pack() { 43 CBZip2OutputStream zOut = null; 44 try { 45 BufferedOutputStream bos = 46 new BufferedOutputStream (new FileOutputStream (zipFile)); 47 bos.write('B'); 48 bos.write('Z'); 49 zOut = new CBZip2OutputStream(bos); 50 zipResource(getSrcResource(), zOut); 51 } catch (IOException ioe) { 52 String msg = "Problem creating bzip2 " + ioe.getMessage(); 53 throw new BuildException(msg, ioe, getLocation()); 54 } finally { 55 FileUtils.close(zOut); 56 } 57 } 58 59 70 protected boolean supportsNonFileResources() { 71 return getClass().equals(BZip2.class); 72 } 73 } 74 | Popular Tags |