Methods Summary |
---|
public void | addConfigured(org.apache.tools.ant.types.ResourceCollection a)Sets the resource to wrap using a single-element collection.
checkChildrenAllowed();
if (resource != null) {
throw new BuildException("you must not specify more than one"
+ " resource");
}
if (a.size() != 1) {
throw new BuildException("only single argument resource collections"
+ " are supported");
}
resource = (Resource) a.iterator().next();
|
public int | compareTo(java.lang.Object other)Delegates to a comparison of names.
if (other == this) {
return 0;
}
if (other instanceof CompressedResource) {
return getResource().compareTo(
((CompressedResource) other).getResource());
}
return getResource().compareTo(other);
|
protected abstract java.lang.String | getCompressionName()
|
public java.io.InputStream | getInputStream()Get an InputStream for the Resource.
InputStream in = getResource().getInputStream();
if (in != null) {
in = wrapStream(in);
}
return in;
|
public long | getLastModified()Tells the modification time in milliseconds since 01.01.1970 .
return getResource().getLastModified();
|
public java.lang.String | getName()Get the name of the resource.
return getResource().getName();
|
public java.io.OutputStream | getOutputStream()Get an OutputStream for the Resource.
OutputStream out = getResource().getOutputStream();
if (out != null) {
out = wrapStream(out);
}
return out;
|
private org.apache.tools.ant.types.Resource | getResource()
if (isReference()) {
return (Resource) getCheckedRef();
} else if (resource == null) {
throw new BuildException("no resource specified");
}
return resource;
|
public long | getSize()Get the size of this Resource.
if (isExists()) {
InputStream in = null;
try {
in = getInputStream();
byte[] buf = new byte[8192];
int size = 0;
int readNow;
while ((readNow = in.read(buf, 0, buf.length)) > 0) {
size += readNow;
}
return size;
} catch (IOException ex) {
throw new BuildException("caught exception while reading "
+ getName(), ex);
} finally {
FileUtils.close(in);
}
} else {
return 0;
}
|
public int | hashCode()Get the hash code for this Resource.
return getResource().hashCode();
|
public boolean | isDirectory()Tells if the resource is a directory.
return getResource().isDirectory();
|
public boolean | isExists()The exists attribute tells whether a file exists.
return getResource().isExists();
|
public boolean | isFilesystemOnly()Fulfill the ResourceCollection contract.
return false;
|
public void | setDirectory(boolean directory)Override setDirectory.
throw new BuildException("you can't change the directory state of a "
+ " compressed resource");
|
public void | setExists(boolean exists)Set the exists attribute.
throw new BuildException("you can't change the exists state of a "
+ " compressed resource");
|
public void | setLastModified(long lastmodified)Override setLastModified.
throw new BuildException("you can't change the timestamp of a "
+ " compressed resource");
|
public void | setName(java.lang.String name)Overridden, not allowed to set the name of the resource.
throw new BuildException("you can't change the name of a compressed"
+ " resource");
|
public void | setRefid(org.apache.tools.ant.types.Reference r)Overrides the base version.
if (resource != null) {
throw noChildrenAllowed();
}
super.setRefid(r);
|
public void | setSize(long size)Override setSize.
throw new BuildException("you can't change the size of a "
+ " compressed resource");
|
public java.lang.String | toString()Get the string representation of this Resource.
return getCompressionName() + " compressed "
+ getResource().toString();
|
protected abstract java.io.InputStream | wrapStream(java.io.InputStream in)Is supposed to wrap the stream to allow decompression on the fly.
|
protected abstract java.io.OutputStream | wrapStream(java.io.OutputStream out)Is supposed to wrap the stream to allow compression on the fly.
|