org.apache.ivy.plugins.repository

Interface Resource

public interface Resource

Represents a resource in an Ivy Repository. The resource interface allows one to obtain the following information about a resource:

Implementation Notes

In implementing the interface you need to ensure the following behaviors:

Method Summary
Resourceclone(String cloneName)
Clones this resource with a new resource with a different name
booleanexists()
Determine if the resource is available.
longgetContentLength()
Get the resource size
longgetLastModified()
Get the date the resource was last modified
StringgetName()
Get the name of the resource.
booleanisLocal()
Is this resource local to this host, i.e. is it on the file system?
InputStreamopenStream()
Opens a stream on this resource

Method Detail

clone

public Resource clone(String cloneName)
Clones this resource with a new resource with a different name

Parameters: cloneName the name of the clone

Returns: the cloned resource

exists

public boolean exists()
Determine if the resource is available.

Note that this method only checks for availability, not for actual existence.

Returns: boolean value indicating if the resource is available.

getContentLength

public long getContentLength()
Get the resource size

Returns: a long value representing the size of the resource in bytes.

getLastModified

public long getLastModified()
Get the date the resource was last modified

Returns: A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs.

getName

public String getName()
Get the name of the resource.

Returns: the repositorie's assigned resource name/identifier.

isLocal

public boolean isLocal()
Is this resource local to this host, i.e. is it on the file system?

Returns: boolean value indicating if the resource is local.

openStream

public InputStream openStream()
Opens a stream on this resource

Returns: the opened input stream