Java FileInputStream Read loadRes(String res)

Here you can find the source of loadRes(String res)

Description

load Res

License

Open Source License

Declaration

static public InputStream loadRes(String res) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    static public InputStream loadRes(String res) throws IOException {
        InputStream is = null;/*from ww  w.j av a  2  s . co  m*/
        if (res.startsWith("file:")) {
            is = new FileInputStream(res.substring("file:".length()));
        } else if (res.startsWith("classpath:")) {
            res = res.substring("classpath:".length());
            is = Thread.currentThread().getContextClassLoader().getResourceAsStream(res);
        } else {
            is = Thread.currentThread().getContextClassLoader().getResourceAsStream(res);
        }
        return is;
    }
}

Related

  1. load(File file)
  2. load(String file)
  3. loadContents(File file)
  4. loadData(File f)
  5. loadFolderFromJar(String path)
  6. loadStackableItems(String fileName)
  7. loadTxtFile(String fileName)
  8. readFile( String filename)
  9. readFile(File f)