Qwylt

java.lang.module
Class ResourceSpace

java.lang.Object
  extended by java.lang.module.ResourceSpace
Direct Known Subclasses:
ClassSpace

public abstract class ResourceSpace
extends java.lang.Object

This class represents an accessor for a set of resources that may be either locally defined, retrieved from delegate ResourceSpacess, or both.

Since:
Jul 7, 2009
Author:
Bryan Atsatt. Copyright (c) 2009 Oracle.

Constructor Summary
ResourceSpace()
           
 
Method Summary
 boolean equals(java.lang.Object other)
          Test if the specified object is equal to this instance, enforcing identity comparison.
abstract  java.util.Set<java.lang.String> getExportedPackages()
          Returns an unmodifiable set of the package names exported by this ResourceSpace.
abstract  java.util.Set<java.lang.String> getImportedPackages()
          Returns an unmodifiable set of the package names imported by this ResourceSpace.
abstract  java.lang.String getName()
          Returns the name of this ClassSpace.
abstract  ResourceSpace getPackageProvider(java.lang.String packageName)
          Returns the ResourceSpace that provides the specified public package.
abstract  java.net.URL getResource(java.lang.String resourcePath)
          Returns the first exported resource with the specified path.
abstract  java.nio.ByteBuffer getResourceData(java.lang.String resourcePath)
          Returns the data for the specified resource or null if not found.
static java.lang.String getResourcePackageName(java.lang.String resourcePath)
          Returns the package name from the specified resource path.
abstract  java.util.Enumeration<java.net.URL> getResources(java.lang.String resourcePath)
          Returns all exported resources with the specified path.
abstract  Version getVersion()
          Returns the version of this ClassSpace.
 int hashCode()
          Returns the identity hash code for this instance.
 java.lang.String toString()
          Returns a string representation of this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceSpace

public ResourceSpace()
Method Detail

getResourcePackageName

public static java.lang.String getResourcePackageName(java.lang.String resourcePath)
Returns the package name from the specified resource path.

Parameters:
resourcePath - The '/' separated relative resource path, which must not have a leading '/'.
Returns:
The '.' separated package name.

getName

public abstract java.lang.String getName()
Returns the name of this ClassSpace.

Returns:
The name.

getVersion

public abstract Version getVersion()
Returns the version of this ClassSpace.

Returns:
The version.

getExportedPackages

public abstract java.util.Set<java.lang.String> getExportedPackages()
Returns an unmodifiable set of the package names exported by this ResourceSpace.

Returns:
the set of exported package names.

getImportedPackages

public abstract java.util.Set<java.lang.String> getImportedPackages()
Returns an unmodifiable set of the package names imported by this ResourceSpace.

Returns:
the set of imported package names.

getPackageProvider

public abstract ResourceSpace getPackageProvider(java.lang.String packageName)
Returns the ResourceSpace that provides the specified public package.

Parameters:
packageName - The exported package name.
Returns:
The provider, which may be this instance, or null if package is not visible.

getResourceData

public abstract java.nio.ByteBuffer getResourceData(java.lang.String resourcePath)
Returns the data for the specified resource or null if not found.

Parameters:
resourcePath - The relative path to the resource, which must use '/' as the path separator and must not have '/' as the first character.
Returns:
A read-only buffer or null if the resource is not contained in this instance.

getResource

public abstract java.net.URL getResource(java.lang.String resourcePath)
Returns the first exported resource with the specified path.

Parameters:
resourcePath - The '/' separated relative resource path, which must not have a leading '/'.
Returns:
The resource or null if not found.

getResources

public abstract java.util.Enumeration<java.net.URL> getResources(java.lang.String resourcePath)
                                                          throws java.io.IOException
Returns all exported resources with the specified path.

Parameters:
resourcePath - The '/' separated relative resource path, which must not have a leading '/'.
Returns:
The resources, empty if no matching resources found.
Throws:
java.io.IOException - If an I/O error occurs. TODO: remove and log exception??

equals

public final boolean equals(java.lang.Object other)
Test if the specified object is equal to this instance, enforcing identity comparison.

Overrides:
equals in class java.lang.Object
Parameters:
other - The object to compare to.
Returns:
true if other is the same as this instance; otherwise, returns false.

hashCode

public final int hashCode()
Returns the identity hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
The identity hash code for this instance.

toString

public java.lang.String toString()
Returns a string representation of this instance.

Overrides:
toString in class java.lang.Object
Returns:
The string.

Qwylt

Send comments or questions to Bryan Atsatt