All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.libxjava.lang.IClassLoader Maven / Gradle / Ivy

The newest version!
/*
 * libxjava -- utility library for cross-Java-platform development
 *             Lib-Cross-Java CDC
 *
 * Copyright (c) 2010 Marcel Patzlaff ([email protected])
 *
 * This library is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see .
 */

package com.github.libxjava.lang;

import java.io.InputStream;


/**
 * Class loading interface for platforms with no {@code java.lang.ClassLoader}.
 * Classloaders are mainly used in the deserialisers.
 * 
 * @author Marcel Patzlaff
 * @version libxjava-cdc - 0.3
 */
public interface IClassLoader {
    /**
     * Returns the Class object associated with the class with the
     * given name. The classpath currently associated with this classloader
     * will be searched.
     * 
     * @param name  the fully qualified name of the desired class
     * @return      the Class object for the class with the specified name
     * @throws ClassNotFoundException   if the class could not be found
     * @throws Error                    if the function fails for any other reason
     */
    Class loadClass(String name) throws ClassNotFoundException;
    
    /**
     * Finds a resource with the given name in the classpath of this classloader.
     * This method returns null if no resource with this name is found.
     * 

* The resource names can be represented in two different formats: absolute or relative. *

* Absolute format: *

    /packagePathName/resourceName
*

* Relative format: *

    resourceName
*

* In the absolute format, the programmer provides a fully qualified name that includes * both the full path and the name of the resource inside the classpath. In the path * names, the character "/" is used as the separator. *

* In the relative format, the programmer provides only the name of the actual resource. * Relative names are converted to absolute names by the system by prefixing the * resource name with the fully qualified package name of class upon which the * getResourceAsStream method was called. * * @param name name of the desired resource * @return a java.io.InputStream object */ InputStream getResourceAsStream(String name); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy