Java Resource File inputStream(Class baseClass, String resourceName)

Here you can find the source of inputStream(Class baseClass, String resourceName)

Description

input Stream

License

Apache License

Declaration

static public InputStream inputStream(Class<?> baseClass,
        String resourceName) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.*;

import java.net.URL;

public class Main {

    static public InputStream inputStream(Class<?> baseClass,
            String resourceName) throws IOException {
        URL url = baseClass.getResource(resourceName);
        if (url == null) {
            throw new FileNotFoundException(String.format(
                    "Resource file is not found. %s", resourceName));
        }//w  ww .  ja  v a 2s. c om
        return url.openStream();
    }
}

Related

  1. getSampleDir(File resourcesDir)
  2. getShortName(String resource, Map nsMap)
  3. getSourceForResource(String s)
  4. getStreamFromResource(Class clazz, String resourceName)
  5. getTestResourceFile(String pName, Class pClass)
  6. isFullIRI(String resource)
  7. loadAutoConfigFiles(ClassLoader classLoader, String resourceName)
  8. loadConfigFile(String resource, Class clazz)
  9. loadUTF8(String resource)