List of usage examples for java.io StreamTokenizer toString
public String toString()
From source file:edu.umd.cfar.lamp.viper.util.StringHelp.java
/** * Checks to see if the file begins with an xml processing directive, eg * <code><?xml?></code>. This method does not check to see that the * file is well-formed, or even if the processing directive is good, just that * the first non-whitespace characters are "<?xml". * * @param f The file to check for xml processing directive * @throws IOException if there is an error while reading the file, eg FileNotFoundException * @return <code>true</code> if the directive was found. *//*w ww .ja v a 2 s . c o m*/ public static boolean isXMLFormat(File f) throws IOException { StreamTokenizer st = new StreamTokenizer(new FileReader(f)); st.wordChars('<', '<'); st.wordChars('>', '>'); st.wordChars('?', '?'); st.nextToken(); return st.toString().startsWith("Token[<?xml"); }