org.apache.tools.ant.types.resources
public abstract class CompressedResource extends Resource
Wraps around another resource, delegates all queries (except getSize) to that other resource but uncompresses/compresses streams on the fly.
Since: Ant 1.7
Constructor Summary | |
---|---|
CompressedResource() no arg constructor | |
CompressedResource(ResourceCollection other)
Constructor with another resource to wrap. |
Method Summary | |
---|---|
void | addConfigured(ResourceCollection a)
Sets the resource to wrap using a single-element collection. |
int | compareTo(Object other)
Delegates to a comparison of names. |
protected abstract String | getCompressionName() |
InputStream | getInputStream()
Get an InputStream for the Resource. |
long | getLastModified()
Tells the modification time in milliseconds since 01.01.1970 .
|
String | getName()
Get the name of the resource. |
OutputStream | getOutputStream()
Get an OutputStream for the Resource. |
long | getSize()
Get the size of this Resource. |
int | hashCode()
Get the hash code for this Resource. |
boolean | isDirectory()
Tells if the resource is a directory. |
boolean | isExists()
The exists attribute tells whether a file exists. |
boolean | isFilesystemOnly()
Fulfill the ResourceCollection contract. |
void | setDirectory(boolean directory)
Override setDirectory. |
void | setExists(boolean exists)
Set the exists attribute. |
void | setLastModified(long lastmodified)
Override setLastModified. |
void | setName(String name)
Overridden, not allowed to set the name of the resource. |
void | setRefid(Reference r)
Overrides the base version. |
void | setSize(long size)
Override setSize. |
String | toString()
Get the string representation of this Resource. |
protected abstract InputStream | wrapStream(InputStream in)
Is supposed to wrap the stream to allow decompression on the fly.
|
protected abstract OutputStream | wrapStream(OutputStream out)
Is supposed to wrap the stream to allow compression on the fly.
|
Parameters: other the resource to wrap.
Parameters: a the resource to wrap as a single element Resource collection.
Parameters: other the object to compare to.
Returns: a negative integer, zero, or a positive integer as this Resource is less than, equal to, or greater than the specified Resource.
Returns: the name of the compression method.
Returns: an InputStream containing this Resource's content.
Throws: IOException if unable to provide the content of this Resource as a stream. UnsupportedOperationException if InputStreams are not supported for this Resource type.
Returns: 0 if the resource does not exist to mirror the behavior
of java.io.File File
.
Returns: the name of the wrapped resource.
Returns: an OutputStream to which content can be written.
Throws: IOException if unable to provide the content of this Resource as a stream. UnsupportedOperationException if OutputStreams are not supported for this Resource type.
Returns: the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.
Returns: hash code as int.
Returns: boolean flag indicating if the resource is a directory.
Returns: true if this resource exists.
Returns: whether this Resource is a FileResource.
Parameters: directory not used.
Throws: BuildException always.
Parameters: exists if true, this resource exists.
Parameters: lastmodified not used.
Throws: BuildException always.
Parameters: name not used.
Throws: BuildException always.
Parameters: r the Reference to set.
Parameters: size not used.
Throws: BuildException always.
Returns: this Resource formatted as a String.
Since: Ant 1.7
Parameters: in InputStream to wrap, will never be null.
Returns: a compressed inputstream.
Throws: IOException if there is a problem.
Parameters: out OutputStream to wrap, will never be null.
Returns: a compressed outputstream.
Throws: IOException if there is a problem.