public static XYPoint [] readXYPoints(String fileName)
    {
        XYPoint points [] = null;
	BufferedReader r = null;
	int nPoints;
	
	parsing: {
	    
	    // Create a reader for the file
	    //
	    try {
		InputStream is = new FileInputStream(fileName);
		r = new BufferedReader(new InputStreamReader(is));
	    }
	    catch (IOException e) {
		System.out.println("IOException while opening " +
				   fileName + "\n" + e);
		break parsing;
	    }
	    
	    try {
		String nextline = r.readLine();
		if (nextline == null) // end of file
		    {
			System.out.println("Error: point file " +
					   fileName + " is empty!\n");
			break parsing;
		    }
		
		nPoints = parseInteger(nextline);
		
	    } catch (IOException e) {
		System.out.println("Error getting # of points from " +
				   fileName + "\n" + e);
		break parsing;
	    }
	    
	    
	    points = new XYPoint [nPoints];
	    
	    for (int j = 0; j < nPoints; j++)
		{
		    try {
			String nextline = r.readLine();
			if (nextline == null) // end of file
			    {
				System.out.println("Error: point file ends " +
						   "after " + j + " points\n" +
						   " (expected " + nPoints + 
						   ")\n");
				break parsing;
			    }
			
			points[j] = parsePoint(nextline);
			
		    } catch (IOException e) {
			System.out.println("IOException while reading line " +
					   j+2 + " from " + fileName + "\n" +
					   e);
			break parsing;
		    }
		}
	}
	
	
	//
	// final cleanup
	//
	
	if (r != null)
	    {
		try {
		    r.close();
		} catch (IOException e) {
		    // hukairs
		}
	    }
	
	return points;
    }