Methods Summary |
---|
private java.io.File | getDest()
File result;
if (null != destfile) {
result = destfile;
} else {
final String file = url.getFile();
String filename;
if (null == file || file.length() <= 1) {
filename = "default.file";
} else {
int index = file.lastIndexOf('/");
if (-1 == index) {
index = 0;
}
filename = file.substring(index);
}
result = new File(destdir, filename);
}
return result;
|
public java.io.File | resolve(org.apache.tools.ant.taskdefs.optional.extension.Extension extension, org.apache.tools.ant.Project project)Returns the file resolved from URL and directory
validate();
final File file = getDest();
final Get get = new Get();
get.setProject(project);
get.setDest(file);
get.setSrc(url);
get.execute();
return file;
|
public void | setDestdir(java.io.File destdir)Sets the destination directory
this.destdir = destdir;
|
public void | setDestfile(java.io.File destfile)Sets the destination file
this.destfile = destfile;
|
public void | setUrl(java.net.URL url)Sets the URL
this.url = url;
|
public java.lang.String | toString()Returns a string representation of the URL
return "URL[" + url + "]";
|
private void | validate()
if (null == url) {
final String message = "Must specify URL";
throw new BuildException(message);
}
if (null == destdir && null == destfile) {
final String message = "Must specify destination file or directory";
throw new BuildException(message);
} else if (null != destdir && null != destfile) {
final String message = "Must not specify both destination file or directory";
throw new BuildException(message);
}
|