Methods Summary |
---|
public void | addConfigured(org.apache.tools.ant.types.ResourceCollection a)Sets the archive that holds this as a single element Resource
collection.
super.addConfigured(a);
if (!a.isFilesystemOnly()) {
throw new BuildException("only filesystem resources are supported");
}
|
protected void | fetchEntry()fetches information from the named entry inside the archive.
ZipFile z = null;
try {
z = new ZipFile(getZipfile(), getEncoding());
setEntry(z.getEntry(getName()));
} catch (IOException e) {
log(e.getMessage(), Project.MSG_DEBUG);
throw new BuildException(e);
} finally {
if (z != null) {
try {
z.close();
} catch (IOException e) {
//?
}
}
}
|
public java.lang.String | getEncoding()Get the encoding to use with the zipfile.
return isReference()
? ((ZipResource) getCheckedRef()).getEncoding() : encoding;
|
public java.io.InputStream | getInputStream()Return an InputStream for reading the contents of this Resource.
if (isReference()) {
return ((Resource) getCheckedRef()).getInputStream();
}
final ZipFile z = new ZipFile(getZipfile(), getEncoding());
ZipEntry ze = z.getEntry(getName());
if (ze == null) {
z.close();
throw new BuildException("no entry " + getName() + " in "
+ getArchive());
}
return new FilterInputStream(z.getInputStream(ze)) {
public void close() throws IOException {
FileUtils.close(in);
z.close();
}
protected void finalize() throws Throwable {
try {
close();
} finally {
super.finalize();
}
}
};
|
public java.io.OutputStream | getOutputStream()Get an OutputStream for the Resource.
if (isReference()) {
return ((Resource) getCheckedRef()).getOutputStream();
}
throw new UnsupportedOperationException(
"Use the zip task for zip output.");
|
public java.io.File | getZipfile()Get the zipfile that holds this ZipResource.
FileResource r = (FileResource) getArchive();
return r.getFile();
|
public void | setEncoding(java.lang.String enc)Set the encoding to use with the zipfile.
checkAttributesAllowed();
encoding = enc;
|
private void | setEntry(org.apache.tools.zip.ZipEntry e)
if (e == null) {
setExists(false);
return;
}
setName(e.getName());
setExists(true);
setLastModified(e.getTime());
setDirectory(e.isDirectory());
setSize(e.getSize());
setMode(e.getUnixMode());
|
public void | setRefid(org.apache.tools.ant.types.Reference r)Overrides the super version.
if (encoding != null) {
throw tooManyAttributes();
}
super.setRefid(r);
|
public void | setZipfile(java.io.File z)Set the zipfile that holds this ZipResource.
setArchive(z);
|