Code example for Scanner

Methods: hasNext, hasNextInt, next, nextInt

0
	 */ 
	public Operation create(Scanner scanner) throws FactoryException {
		int x, y;
		String charset;
 
		if (scanner.hasNextInt()) {
			x = scanner.nextInt();
			if (scanner.hasNextInt()) {
				y = scanner.nextInt();
				if (scanner.hasNext()) {
					charset = scanner.next();
				} else { 
					throw new FactoryException(); 
				} 
			} else { 
				throw new FactoryException(); 
			} 
		} else { 
			throw new FactoryException(); 
		}