Java FileInputStream Create getStream(String fileName, boolean resource)

Here you can find the source of getStream(String fileName, boolean resource)

Description

get Stream

License

Apache License

Declaration

private static InputStream getStream(String fileName, boolean resource) throws FileNotFoundException 

Method Source Code

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

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.InputStream;

public class Main {
    private static InputStream getStream(String fileName, boolean resource) throws FileNotFoundException {
        if (resource) {
            return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
        }/*from   ww w  .ja va2 s .c  o m*/
        return new FileInputStream(fileName);
    }
}

Related

  1. getStreamForFile(String fileName)
  2. getStreamForFile(String path)
  3. getStreamFromFile(File file)