Code example for Scanner

Methods: useDelimiter

0
		this(new InputStreamReader(in));
	} 
 
	public SqlScanner(Reader in) {
		this.in = new BufferedReader(in, 512);
		this.scanner = new Scanner(in);
		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());
		}