Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; public class Main { private static InputStream openFile(File configFile) { try { if (configFile == null) { return null; } else { return new FileInputStream(configFile); } } catch (FileNotFoundException e) { throw new IllegalArgumentException("Could not open config file " + configFile, e); } } }