Java Resource Path Get getResources(ClassLoader cl, String resourcePath)

Here you can find the source of getResources(ClassLoader cl, String resourcePath)

Description

Returns a resources founded from the ClassLoader.

License

Open Source License

Parameter

Parameter Description
cl a parameter
resourcePath a parameter

Declaration

private static Enumeration<URL> getResources(ClassLoader cl, String resourcePath) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Angelo Zerr and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from w  w  w .ja  v  a  2s .c  om
 *     Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 *******************************************************************************/

import java.io.IOException;
import java.net.URL;

import java.util.Enumeration;

public class Main {
    /**
     * Returns a resources founded from the ClassLoader.
     * 
     * @param cl
     * @param resourcePath
     * @return
     */
    private static Enumeration<URL> getResources(ClassLoader cl, String resourcePath) {
        try {
            return cl == null ? ClassLoader.getSystemResources(resourcePath) : cl.getResources(resourcePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getResourcePath(String fileName)
  2. getResourcePath(String name)
  3. getResourcePath(String path)
  4. getResourcePath(String resource)
  5. getResourcePath(String resource)
  6. getResources(String path, ClassLoader loader)
  7. getResources(String resourcePath, Class caller)
  8. getResourceStream(final String bundle, final String path)
  9. getResourceStream(String path)