anthill
Interface Resource

All Known Subinterfaces:
URLResource
All Known Implementing Classes:
AnthillResource, RandomResource, SimpleURLResource, UrlResource, UrlResource, URLResourceImpl, UrlResourceSet, UrlResourceSet

public interface Resource

The Resource interface describes resources that may be stored in a nests. Each resource is uniquely identified by its string name.

Version:
$Revision: 1.5 $
Author:
Alberto Montresor

Method Summary
 String getAttribute(String name)
          Returns the value associated to the specified attribute name, or null if there is no attribute with that name.
 long getContentLength()
          Return the lenght of the content of the resource, if available; otherwise, it returns -1.
 InputStream getInputStream()
          Return an input stream to download the contents of the resource.
 Object getKey()
          Returns the key identifier of the object.
 String getName()
          Returns the string identifier of the object.
 long size()
          Return the space required to store the resource object.
 

Method Detail

getKey

public Object getKey()
Returns the key identifier of the object.


getName

public String getName()
Returns the string identifier of the object.


getAttribute

public String getAttribute(String name)
Returns the value associated to the specified attribute name, or null if there is no attribute with that name.

Parameters:
name - the name of the attribute

getInputStream

public InputStream getInputStream()
                           throws IOException
Return an input stream to download the contents of the resource. Depending on the implementation, the contents may be read from the local storage, if the resource has been copied locally; or downloaded remotely, otherwise.

Returns:
an input stream to read the contents of a resource;
IOException

getContentLength

public long getContentLength()
Return the lenght of the content of the resource, if available; otherwise, it returns -1.


size

public long size()
Return the space required to store the resource object.