org.openbp.common.classloader
Class XClassLoaderUtil

java.lang.Object
  extended by org.openbp.common.classloader.XClassLoaderUtil

public final class XClassLoaderUtil
extends java.lang.Object

Utility classes for the XClassLoader package.

Author:
Heiko Erhardt

Method Summary
static void addResourceEntryForClass(XClassLoader cl, java.lang.String resourceName, ResourceEntry entry)
          Adds the given resource entry as class mapping of the entry specifies a class file.
static byte[] readFileContent(java.io.File file)
          Reads the resource from the repository.
static void scanJarStream(XClassLoader cl, java.io.InputStream in, java.net.URL jarFileUrl)
          Reads the zip file from the given input stream, adding all of its contents that are java class files to the entry table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFileContent

public static byte[] readFileContent(java.io.File file)
                              throws java.lang.Exception
Reads the resource from the repository.

Parameters:
file - File to read
Returns:
Bytes that define the content of the entry (i. e. the class code)
Throws:
java.lang.Exception - On any error that occurs while scanning the repositories specified in the class loader configuration

scanJarStream

public static void scanJarStream(XClassLoader cl,
                                 java.io.InputStream in,
                                 java.net.URL jarFileUrl)
                          throws java.lang.Exception
Reads the zip file from the given input stream, adding all of its contents that are java class files to the entry table.

Parameters:
cl - The class loader
in - Input stream to the jar file
jarFileUrl - URL of the Jar file
Throws:
java.lang.Exception - On any error that occurs while scanning the repositories specified in the class loader configuration

addResourceEntryForClass

public static void addResourceEntryForClass(XClassLoader cl,
                                            java.lang.String resourceName,
                                            ResourceEntry entry)
Adds the given resource entry as class mapping of the entry specifies a class file. Does nothing if the entry does not denote a class file.

Parameters:
cl - The class loader
resourceName - Resource name (relative path name or zip entry name)
entry - Entry to add


Copyright © 2011. All Rights Reserved.