Code example for Scanner

Methods: hasNext

0
		scanner.useDelimiter("\\s*;");
		 
	} 
 
	public boolean hasNext() { 
		return scanner.hasNext();
	} 
 
	public String next() throws NoSuchElementException {
		String initial = scanner.next();
		// Removes the comment 
		StringBuffer sql = new StringBuffer(initial.replaceAll("(--).*\n", ""));
		if (sql.toString().contains("FOR EACH ")) {
			sql.append(";").append(scanner.next());
		} 
		return sql.toString().trim();
	} 
 
	public void close() throws IOException { 
		in.close();
	}