private File getAndValidateFile(String pFile, String pWhat) throws IOException { File ret = new File(pFile); if (!ret.exists()) { throw new FileNotFoundException("No such " + pWhat + " " + pFile); } if (!ret.canRead()) { throw new IOException( pWhat.substring(0, 1).toUpperCase() + pWhat.substring(1) + " " + pFile + " is not readable"); } return ret; }