/** * Returns <code>true</code>, if a given text file contains only ASCII characters, otherwise * returns <code>false</code>. * * @param textFile * The given text file. * @return <code>true</code>, if the given text file contains only ASCII characters, * <code>false</code> otherwise. * @throws IOException * If an I/O exception occurred. */ public static boolean isAsciiFile(File textFile) throws IOException { boolean isAscii = true; FileInputStream iStream = null; try { iStream = new FileInputStream(textFile); isAscii = isAsciiStream(iStream); iStream.close(); } catch (IOException exc) { isAscii = false; throw exc; } finally { if (iStream != null) try { iStream.close(); } catch (Exception e) { } } return isAscii; }