Demos and Usage of java.lang.ClassLoader.getResourceAsStream(String name)


   1: 
   2:    private final ClassLoader cl;
   3:    private String base;
   4:         ...
   5: 
   6:    public CLLoader(ClassLoader cl, String base)
   7:    {
   8:         ...
   9: 
  10:    public CLLoader(ClassLoader cl)
  11:    {
  12:         ...
  13:    {
  14:       return cl.getResourceAsStream(base.length() == 0 ? name.substring(1) : base + name);

View Full Code Here
   1: 
   2:     private final ClassLoader loader; 
   3: 
   4:         ...
   5: 
   6:     public ClassLoaderResolver(ClassLoader l) { 
   7:         loader = l;
   8:         ...
   9:     public InputStream getAsStream(String name) { 
  10:         return loader.getResourceAsStream(name);
  11:     } 

View Full Code Here
   1:   
   2:   public HTMLReportGroovyResourceManager(GroovyClassLoader classloader, String groovyPath) {
   3:         ...
   4:     super(classloader) ;
   5:     groovyPath_ =  groovyPath ;
   6:         ...
   7:     if(file.exists()) return  new FileInputStream(file);
   8:     ClassLoader cl = Thread.currentThread().getContextClassLoader() ;
   9:         ...
  10:     return cl.getResourceAsStream(name) ;

View Full Code Here
   1:         } else if (storeFileType.equalsIgnoreCase("resource")) {
   2:             ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
   3: 
   4:         ...
   5:             return classLoader.getResourceAsStream(storeFile);
   6:         } else {
   7:             log.fatal("property storeFileType must be one of (file,resource)");

View Full Code Here
   1: 
   2:     public static InputStream getResourceStream(ClassLoader loader,
   3:             String filename) {
   4:         ...
   5:         return loader.getResourceAsStream(filename);
   6:     }
   7:         ...
   8: 
   9:     public static Reader getResourceReader(ClassLoader loader, String filename) {
  10:         return convertToReader(getResourceStream(loader, filename));
  11:         ...
  12: 
  13:     public static String readRawResource(ClassLoader loader, String filename)

View Full Code Here
   1:     {
   2:         return cla.getResourceAsStream(res) ;
   3:     }    
   4:         ...
   5:     
   6:     final static public InputStream getInputStream(ClassLoader cl, String res)
   7:     {
   8:         ...
   9:         return cl.getResourceAsStream(res) ;
  10:     }
  11:         ...
  12:     
  13:     final static public byte[] getBytes(ClassLoader cl, String res)

View Full Code Here
   1: {
   2:     ClassLoader _classLoader;
   3: 
   4:         ...
   5:     ClassLoaderResourceLoader(ClassLoader classLoader)
   6:     {
   7:         ...
   8:     {
   9:         return _classLoader.getResourceAsStream(resourceName);
  10:     }

View Full Code Here
   1:     public static InputStream getFoafAsStream() {
   2:         ClassLoader classloader = Thread.currentThread().getContextClassLoader();
   3:         ...
   4:         return classloader.getResourceAsStream("foaf.xml");
   5:     }
   6:         ...
   7:     public static InputStream getICALAsStream() {
   8:         ClassLoader classloader = Thread.currentThread().getContextClassLoader();
   9:         ...
  10:         return classloader.getResourceAsStream("icaltzd.rdfs");

View Full Code Here
   1:         try {
   2:             ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
   3:             if (contextLoader != null) {
   4:         ...
   5:                     resourcePath_ = resourceUrl.getPath();
   6:                     resourceLoaderId_ = "Context ClassLoader: " + contextLoader;
   7:         ...
   8:                     return contextLoader.getResourceAsStream(resourceName_);
   9:                 }
  10:         ...
  11:             }
  12:             ClassLoader thisLoader = getClass().getClassLoader();

View Full Code Here
   1:     {
   2:     ClassLoader loader =
   3:         Thread.currentThread().getContextClassLoader();
   4:         ...
   5:     return loader.getResourceAsStream("unicode/" + rsrcName);
   6:     }
   7: 
   8:     public static class UnicodeTest

View Full Code Here
   1: 
   2:     protected static InputStream getResourceAsStream(final ClassLoader loader,
   3:                                                      final String name) {
   4:         ...
   5:                     if (loader != null) {
   6:                         return loader.getResourceAsStream(name);
   7:                     } else {
   8:         ...
   9:                         return ClassLoader.getSystemResourceAsStream(name);
  10:                     }
  11:         ...
  12: 
  13:         ClassLoader contextClassLoader =

View Full Code Here
   1:         final Class caller = ClassLoaderResolver.getCallerClass (1);
   2:         final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
   3:         
   4:         ...
   5:         final Class caller = ClassLoaderResolver.getCallerClass (1);
   6:         final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
   7:         
   8:         ...
   9:         else
  10:             return ClassLoader.getSystemResource (name);
  11:     }
  12:         ...
  13:         if (loader != null)
  14:             return loader.getResourceAsStream(name);

View Full Code Here
   1:     private final DDBeanRoot root;
   2:     private final ClassLoader rootCL;
   3:     private final List entries;
   4:         ...
   5:     public InputStream getEntry(String name) {
   6:         return rootCL.getResourceAsStream(name);
   7:     }
   8:         ...
   9: 
  10:     protected ClassLoader getModuleLoader() {
  11:         return rootCL;

View Full Code Here
   1:    {
   2:       ClassLoader loader = Thread.currentThread().getContextClassLoader();
   3:         ...
   4:       return loader.getResourceAsStream(resourceName);
   5:    }
   6: 
   7:    public static List unmarshalXML(Class klass, String resourceName)

View Full Code Here
   1: 
   2:     protected static InputStream getResourceAsStream(final ClassLoader loader,
   3:                                                    final String name) {
   4:         ...
   5:                     if (loader != null) {
   6:                         return loader.getResourceAsStream(name);
   7:                     } else {
   8:         ...
   9:                         return ClassLoader.getSystemResourceAsStream(name);
  10:                     }
  11:         ...
  12:     private String getFileContent(String fileName) {
  13:         ClassLoader contextClassLoader =

View Full Code Here