FileDocCategorySizeDatePackage
Resource.javaAPI DocApache log4j 1.2.154375Sat Aug 25 00:09:38 BST 2007org.apache.log4j.lf5.util

Resource

public class Resource extends Object
Resource encapsulates access to Resources via the Classloader.
author
Michael J. Sikorsky
author
Robert Shaw

Fields Summary
protected String
_name
Constructors Summary
public Resource()
Default, no argument constructor.

    super();
  
public Resource(String name)
Construct a Resource given a name.

see
#setName(String)

    _name = name;
  
Methods Summary
public java.io.InputStreamgetInputStream()
Get the InputStream for this Resource. Uses the classloader from this Resource.

see
#getInputStreamReader
see
ResourceUtils

    InputStream in = ResourceUtils.getResourceAsStream(this, this);

    return (in);
  
public java.io.InputStreamReadergetInputStreamReader()
Get the InputStreamReader for this Resource. Uses the classloader from this Resource.

see
#getInputStream
see
ResourceUtils

    InputStream in = ResourceUtils.getResourceAsStream(this, this);

    if (in == null) {
      return null;
    }

    InputStreamReader reader = new InputStreamReader(in);

    return reader;
  
public java.lang.StringgetName()
Get the name of the resource. Set setName() for a description of a resource.

see
#setName

    return (_name);
  
public java.net.URLgetURL()
Get the URL of the Resource. Uses the classloader from this Resource.

see
ResourceUtils

    return (ResourceUtils.getResourceAsURL(this, this));
  
public voidsetName(java.lang.String name)
Set the name of the resource.

A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

The name of a resource is a "/"-separated path name that identifies the resource.

see
#getName()

    _name = name;