org.jboss.shrinkwrap.api.asset
Class ClassLoaderAsset

java.lang.Object
  extended by org.jboss.shrinkwrap.api.asset.ClassLoaderAsset
All Implemented Interfaces:
Asset

public class ClassLoaderAsset
extends java.lang.Object
implements Asset

ClassloaderAsset Implementation of a Asset backed by a resource located in the Classloader.

Author:
Aslak Knutsen

Constructor Summary
ClassLoaderAsset(java.lang.String resourceName)
          Load a named resource using the current threads context classloader.
ClassLoaderAsset(java.lang.String resourceName, java.lang.ClassLoader classLoader)
          Load a named resource using the given classloader.
 
Method Summary
 java.io.InputStream openStream()
          Opens up the given resource as a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderAsset

public ClassLoaderAsset(java.lang.String resourceName)
Load a named resource using the current threads context classloader.

Parameters:
resourceName - The name of the resource to load
Throws:
java.lang.IllegalArgumentException - resourceName can not be null
java.lang.IllegalArgumentException - resourceName must be found in given classloader

ClassLoaderAsset

public ClassLoaderAsset(java.lang.String resourceName,
                        java.lang.ClassLoader classLoader)
Load a named resource using the given classloader.

Parameters:
resourceName - The name of the resource to load
classLoader - The ClassLoader to use
Throws:
java.lang.IllegalArgumentException - resourceName can not be null
java.lang.IllegalArgumentException - classloader can not be null
java.lang.IllegalArgumentException - resourceName must be found in given classloader
Method Detail

openStream

public java.io.InputStream openStream()
Opens up the given resource as a stream.

Specified by:
openStream in interface Asset
Returns:
A new open InputStream for each call, or null if this type simply represents a logical path within an Archive


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