org.jboss.classloader.plugins
Class ClassLoaderUtils

java.lang.Object
  extended by org.jboss.classloader.plugins.ClassLoaderUtils

public class ClassLoaderUtils
extends Object

ClassLoaderUtils.

Version:
$Revision: 1.1 $
Author:
Adrian Brock, Ales Justin

Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static void checkClassName(String className)
          Check the class name makes sense
static String classNameToPath(Class<?> clazz)
          Convert a class into a path
static String classNameToPath(String className)
          Convert a class name into a path
static String classToString(Class<?> clazz)
          Formats the class as a string
static void classToString(Class<?> clazz, StringBuilder builder)
          Formats a class into a string builder
static String getClassPackageName(String className)
          Get the package name for a class
static String getResourcePackageName(String className)
          Get the package name for a class
static byte[] loadByteCode(String name, InputStream is)
          Load bytecode from a stream
static byte[] loadBytes(InputStream is)
          Load bytes from a stream
static String packageNameToPath(String className)
          Convert a class's package name into a path
protected static byte[] readBytes(InputStream is)
          Read bytes.
static String resourceNameToClassName(String resourceName)
          Convert a resource name to a class name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderUtils

public ClassLoaderUtils()
Method Detail

checkClassName

public static final void checkClassName(String className)
                                 throws ClassNotFoundException
Check the class name makes sense

Parameters:
className - the class name
Throws:
ClassNotFoundException - for a malformed class name

classNameToPath

public static final String classNameToPath(String className)
Convert a class name into a path

Parameters:
className - the class name
Returns:
the path

classNameToPath

public static final String classNameToPath(Class<?> clazz)
Convert a class into a path

Parameters:
clazz - the class
Returns:
the path

resourceNameToClassName

public static final String resourceNameToClassName(String resourceName)
Convert a resource name to a class name

Parameters:
resourceName - the resource name
Returns:
the class name or null if it is not a class

packageNameToPath

public static final String packageNameToPath(String className)
Convert a class's package name into a path

Parameters:
className - the class name
Returns:
the path

getClassPackageName

public static final String getClassPackageName(String className)
Get the package name for a class

Parameters:
className - the class name
Returns:
the package name or the empty string if there is no package

getResourcePackageName

public static final String getResourcePackageName(String className)
Get the package name for a class

Parameters:
className - the class name
Returns:
the package name or the empty string if there is no package

loadByteCode

public static final byte[] loadByteCode(String name,
                                        InputStream is)
Load bytecode from a stream

Parameters:
name - the class name
is - the input stream
Returns:
the byte code

loadBytes

public static final byte[] loadBytes(InputStream is)
                              throws IOException
Load bytes from a stream

Parameters:
is - the input stream
Returns:
the bytes
Throws:
IOException - for any error

readBytes

protected static final byte[] readBytes(InputStream is)
                                 throws IOException
Read bytes. Doesn't close inputstream.

Parameters:
is - the input stream
Returns:
the bytes
Throws:
IOException - for any error
IllegalArgumentException - for null is parameter

classToString

public static final String classToString(Class<?> clazz)
Formats the class as a string

Parameters:
clazz - the class
Returns:
the string

classToString

public static final void classToString(Class<?> clazz,
                                       StringBuilder builder)
Formats a class into a string builder

Parameters:
clazz - the class
builder - the builder


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.