2004.04.29


com.jdc.sys
Class SystemResource

java.lang.Object
  |
  +--com.jdc.sys.SystemResource

public class SystemResource
extends Object

Class SystemResource represents a system resource. A system resource is some data, e.g. images, audio, text, etc., that may be accessed by an application in a way that is independent of the location of the code. A system resource may be a file or directory.

SystemResource is commonly used to load application configuration files.

SystemResource attempts to load the system resource file using the following order of precedence:

Further, for 1. and 2. above, SystemResource attempts to load the system resource file using the following methods:

Reference: http://www.javaworld.com/javaworld/javaqa/2002-11/02-qa-1122-resources.html

Version:
1.0
Author:
Jay Damon

Constructor Summary
SystemResource()
          Constructs a new SystemResource object.
SystemResource(Object object)
          Constructs a new SystemResource object for the specified object..
SystemResource(Object object, boolean checkFirst)
          Constructs a new SystemResource object for the specified object..
 
Method Summary
 boolean exists()
          Determines whether the system resource exists.
 File getFile()
          Returns the system resource file name.
 SystemResource getName(String resourceName)
          Returns a system resource for the specified system resource name.
 String getPath()
          Returns the system resource file path name.
 String toString()
          Returns a String representation of the SystemResource object.
 URL toURL()
          Returns a URL representation of the SystemResource object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemResource

public SystemResource()
Constructs a new SystemResource object.


SystemResource

public SystemResource(Object object)
Constructs a new SystemResource object for the specified object..


SystemResource

public SystemResource(Object object,
                      boolean checkFirst)
Constructs a new SystemResource object for the specified object..

Method Detail

exists

public boolean exists()
Determines whether the system resource exists.

Returns:
True if the system resource exists. False if the system resource does not exist.

getName

public SystemResource getName(String resourceName)
Returns a system resource for the specified system resource name.

Returns:
This SystemResource object.

getFile

public File getFile()
Returns the system resource file name.

Returns:
The system resource file name.

getPath

public String getPath()
Returns the system resource file path name.

Returns:
The system resource file path name.

toString

public String toString()
Returns a String representation of the SystemResource object.

Overrides:
toString in class Object
Returns:
A String representation of the SystemResource. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

toURL

public URL toURL()
Returns a URL representation of the SystemResource object.

Returns:
A URL representation of the SystemResource. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.