FileDocCategorySizeDatePackage
GZip.javaAPI DocApache Ant 1.702365Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs

GZip

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

Fields Summary
Constructors Summary
Methods Summary
protected voidpack()
perform the GZip compression operation.

        GZIPOutputStream zOut = null;
        try {
            zOut = new GZIPOutputStream(new FileOutputStream(zipFile));
            zipResource(getSrcResource(), zOut);
        } catch (IOException ioe) {
            String msg = "Problem creating gzip " + 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 <gzip>. 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 case supports non file resources.
since
Ant 1.7

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