org.ckkloverdos.resource
Class RcUtil

java.lang.Object
  extended by org.ckkloverdos.resource.RcUtil

public final class RcUtil
extends java.lang.Object

Resource-related utilities.

Author:
Christos KK Loverdos

Method Summary
static ClassLoaderResourceContext getThreadClassLoaderContext()
          Returns a class loader resource context based on the context class loader.
static FileResourceContext getUserDirResourceContext()
          Returns a file resource context from the user.dir property.
static void main(java.lang.String[] args)
           
static java.lang.String nameUnderPackage(java.lang.String name, java.lang.Class c)
          Constructs a new name under the package of the given class.
static java.lang.String nameUnderPackage(java.lang.String name, java.lang.Package p)
          Constructs a new name under the given package.
static java.lang.String normalize(java.lang.String name)
          Normalizes the resource name, so that a resource context will use the normalized name to resolve the resource.
static IResource safe(IResource rc)
          Returns the provided resource if not null, otherwise it returns EmptyResource.INSTANCE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

safe

public static IResource safe(IResource rc)
Returns the provided resource if not null, otherwise it returns EmptyResource.INSTANCE.

Parameters:
rc -

normalize

public static java.lang.String normalize(java.lang.String name)
Normalizes the resource name, so that a resource context will use the normalized name to resolve the resource. All dots except the last one (which is considered as part of the resource extension) are translated to slashes.

Parameters:
name -

getUserDirResourceContext

public static FileResourceContext getUserDirResourceContext()
Returns a file resource context from the user.dir property.


nameUnderPackage

public static java.lang.String nameUnderPackage(java.lang.String name,
                                                java.lang.Class c)
Constructs a new name under the package of the given class.

Parameters:
name -
c -

nameUnderPackage

public static java.lang.String nameUnderPackage(java.lang.String name,
                                                java.lang.Package p)
Constructs a new name under the given package.

Parameters:
name -
p -

getThreadClassLoaderContext

public static ClassLoaderResourceContext getThreadClassLoaderContext()
Returns a class loader resource context based on the context class loader.


main

public static void main(java.lang.String[] args)


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.