consciouscode.util.resource
Interface Resource


public interface Resource

An abstraction for an available resource in some (potentially) hierarchical repository. In many cases a resource is just a file on disk, but it could be stored other ways (for example, in a ZIP file, or on a remote server). This interface allows an application to use such resources without regard to their particular storage mechanism.

Resources are safe for use from multiple threads.


Method Summary
 Iterator<Resource> childResources()
           
 String getName()
          Gets the name of this resource within it's parent directory.
 ResourceTree getResourceTree()
          Gets the ResourceTree that contains this resource.
 URL getUrl()
           
 boolean isDirectory()
          Indicates whether this resource is a directory, perhaps with child resources.
 

Method Detail

getName

String getName()
Gets the name of this resource within it's parent directory. The name of the base directory of a ResourceTree may be (but need not be) empty.

Returns:
the name of this resource; not null.

getUrl

URL getUrl()

isDirectory

boolean isDirectory()
Indicates whether this resource is a directory, perhaps with child resources.

Returns:
true if this resource is a directory.

childResources

Iterator<Resource> childResources()

getResourceTree

ResourceTree getResourceTree()
Gets the ResourceTree that contains this resource.

Returns:
may be null.


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.