All pastes #357524 Raw Edit

Wolph

public java v1 · immutable
·published 2007-02-15 19:20 UTC
rendered paste body
/* solving it ugly because the fileformat changed... */Matcher matcher;String line = br.readLine();matcher = Pattern.compile("([0-9]+)\\s([0-9]+)").matcher(line);if(matcher.find()){	height = Integer.parseInt(matcher.group(1));	width = Integer.parseInt(matcher.group(2));}else{	Pattern pattern = Pattern.compile("([0-9]+)");	matcher = pattern.matcher(line);	if(matcher.find()) width = Integer.parseInt(matcher.group(1));	line = br.readLine();	matcher = pattern.matcher(line);	if(matcher.find()) height = Integer.parseInt(matcher.group(1));	if(height == 0 || width == 0){		System.err.format("Invalid file, unable to read the map size.\n");		System.exit(-2);	}}