Methods Summary |
---|
public void | addConfigured(org.apache.tools.ant.types.ResourceCollection a)Set the source Archive resource.
if (a.size() != 1) {
throw new BuildException("only single argument resource collections"
+ " are supported as archives");
}
setSrcResource((Resource) a.iterator().next());
|
private void | createDestFile(java.lang.String defaultExtension)
String sourceName = source.getName();
int len = sourceName.length();
if (defaultExtension != null
&& len > defaultExtension.length()
&& defaultExtension.equalsIgnoreCase(
sourceName.substring(len - defaultExtension.length()))) {
dest = new File(dest, sourceName.substring(0,
len - defaultExtension.length()));
} else {
dest = new File(dest, sourceName);
}
|
public void | execute()Execute the task.
File savedDest = dest; // may be altered in validate
try {
validate();
extract();
} finally {
dest = savedDest;
}
|
protected abstract void | extract()Do the uncompressing.
This is to be overridden by subclasses.
|
protected abstract java.lang.String | getDefaultExtension()Get the extension.
This is to be overridden by subclasses.
|
public void | setDest(java.lang.String dest)
log("DEPRECATED - The setDest(String) method has been deprecated."
+ " Use setDest(File) instead.");
setDest(getProject().resolveFile(dest));
|
public void | setDest(java.io.File dest)The destination file or directory; optional.
this.dest = dest;
|
public void | setSrc(java.lang.String src)
log("DEPRECATED - The setSrc(String) method has been deprecated."
+ " Use setSrc(File) instead.");
setSrc(getProject().resolveFile(src));
|
public void | setSrc(java.io.File src)The file to expand; required.
setSrcResource(new FileResource(src));
|
public void | setSrcResource(org.apache.tools.ant.types.Resource src)The resource to expand; required.
if (!src.isExists()) {
throw new BuildException("the archive doesn't exist");
}
if (src.isDirectory()) {
throw new BuildException("the archive can't be a directory");
}
if (src instanceof FileResource) {
source = ((FileResource) src).getFile();
} else if (!supportsNonFileResources()) {
throw new BuildException("Only FileSystem resources are"
+ " supported.");
}
srcResource = src;
|
protected boolean | supportsNonFileResources()Whether this task can deal with non-file resources.
This implementation returns false.
return false;
|
private void | validate()
if (srcResource == null) {
throw new BuildException("No Src specified", getLocation());
}
if (dest == null) {
dest = new File(source.getParent());
}
if (dest.isDirectory()) {
String defaultExtension = getDefaultExtension();
createDestFile(defaultExtension);
}
|