Here you can find the source of openInputStream(File file)
public static FileInputStream openInputStream(File file) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static FileInputStream openInputStream(File file) throws IOException { if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); }//from w w w.jav a 2s . c om if (file.canRead() == false) { throw new IOException("File '" + file + "' cannot be read"); } } else { throw new FileNotFoundException("File '" + file + "' does not exist"); } return new FileInputStream(file); } }