FileDocCategorySizeDatePackage
BZip2.javaAPI DocApache Ant 1.702546Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs

BZip2

public class BZip2 extends Pack
Compresses a file with the BZIP2 algorithm. Normally used to compress non-compressed archives such as TAR files.
since
Ant 1.5
ant.task
category="packaging"

Fields Summary
Constructors Summary
Methods Summary
protected voidpack()
Compress the zipFile.

        CBZip2OutputStream zOut = null;
        try {
            BufferedOutputStream bos =
                new BufferedOutputStream(new FileOutputStream(zipFile));
            bos.write('B");
            bos.write('Z");
            zOut = new CBZip2OutputStream(bos);
            zipResource(getSrcResource(), zOut);
        } catch (IOException ioe) {
            String msg = "Problem creating bzip2 " + ioe.getMessage();
            throw new BuildException(msg, ioe, getLocation());
        } finally {
            FileUtils.close(zOut);
        }
    
protected booleansupportsNonFileResources()
Whether this task can deal with non-file resources.

This implementation returns true only if this task is <bzip2>. Any subclass of this class that also wants to support non-file resources needs to override this method. We need to do so for backwards compatibility reasons since we can't expect subclasses to support resources.

return
true if this task support non file resources.
since
Ant 1.7

        return getClass().equals(BZip2.class);