Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public abstract Class Pack

extends Task
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.BZip2, org.apache.tools.ant.taskdefs.GZip
Imports
java.io.File, .IOException, .InputStream, .OutputStream, org.apache.tools.ant.BuildException, .Task, org.apache.tools.ant.types.Resource, .ResourceCollection, org.apache.tools.ant.types.resources.FileProvider, .FileResource

Abstract Base class for pack tasks.
Since
Ant 1.5

Field Summary

Modifier and TypeField and Description
private static final int
protected File
private Resource
protected File
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Pack()

Method Summary

Modifier and TypeMethod and Description
public void
addConfigured(ResourceCollection
the resource to pack as a single element Resource collection.
a
)

Set the source resource.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

validate, then hand off to the subclass
public Resource

Returns:

the source.
getSrcResource
()

The source resource.

protected abstract void
pack()

subclasses must implement this method to do their compression

public void
setDestfile(File
the destination file
zipFile
)

the required destination file.

public void
setSrc(File
the source file
src
)

the file to compress; required.

public void
setSrcResource(Resource
resource to expand
src
)

The resource to pack; required.

public void
setZipfile(File
the destination file
zipFile
)

the required destination file.

protected boolean

Returns:

false.
supportsNonFileResources
()

Whether this task can deal with non-file resources.

private void
validate()

validation routine

private void
zipFile(InputStream
the stream to zip
in
,
OutputStream
the output stream
zOut
)

zip a stream to an output stream

protected void
zipFile(File
the file to zip
file
,
OutputStream
the output stream
zOut
)

zip a file to an output stream

protected void
zipResource(Resource
the resource to zip
resource
,
OutputStream
the output stream
zOut
)

zip a resource to an output stream

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

BUFFER_SIZEback to summary
private static final int BUFFER_SIZE
sourceback to summary
protected File source
srcback to summary
private Resource src
zipFileback to summary
protected File zipFile

Constructor Detail

Packback to summary
public Pack()

Method Detail

addConfiguredback to summary
public void addConfigured(ResourceCollection a)

Set the source resource.

Parameters
a:ResourceCollection

the resource to pack as a single element Resource collection.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

validate, then hand off to the subclass

Annotations
@Override
Exceptions
BuildException:
on error
getSrcResourceback to summary
public Resource getSrcResource()

The source resource.

Returns:Resource

the source.

Since
Ant 1.7
packback to summary
protected abstract void pack()

subclasses must implement this method to do their compression

setDestfileback to summary
public void setDestfile(File zipFile)

the required destination file.

Parameters
zipFile:File

the destination file

setSrcback to summary
public void setSrc(File src)

the file to compress; required.

Parameters
src:File

the source file

setSrcResourceback to summary
public void setSrcResource(Resource src)

The resource to pack; required.

Parameters
src:Resource

resource to expand

setZipfileback to summary
public void setZipfile(File zipFile)

the required destination file.

Parameters
zipFile:File

the destination file

supportsNonFileResourcesback to summary
protected boolean supportsNonFileResources()

Whether this task can deal with non-file resources.

This implementation returns false.

Returns:boolean

false.

Since
Ant 1.7
validateback to summary
private void validate() throws BuildException

validation routine

Exceptions
BuildException:
if anything is invalid
zipFileback to summary
private void zipFile(InputStream in, OutputStream zOut) throws IOException

zip a stream to an output stream

Parameters
in:InputStream

the stream to zip

zOut:OutputStream

the output stream

Exceptions
IOException:
if something goes wrong
zipFileback to summary
protected void zipFile(File file, OutputStream zOut) throws IOException

zip a file to an output stream

Parameters
file:File

the file to zip

zOut:OutputStream

the output stream

Exceptions
IOException:
on error
zipResourceback to summary
protected void zipResource(Resource resource, OutputStream zOut) throws IOException

zip a resource to an output stream

Parameters
resource:Resource

the resource to zip

zOut:OutputStream

the output stream

Exceptions
IOException:
on error