class CountryUtil {

    public static ArrayList<Country> parse(InputStream is) throws IOException {
        // convert into a buffered reader
        BufferedReader in =  new BufferedReader(new InputStreamReader(is));
        String line = null; //not declared within while loop
        ArrayList<Country> c = new ArrayList<Country>();
        /*
         * readLine is a bit quirky :
         * it returns the content of a line MINUS the newline.
         * it returns null only for the END of the stream.
         * it returns an empty String if two newlines appear in a row.
         */
        while ((line = in.readLine()) != null) {
            if (!line.equals("") && !line.startsWith("#")) {
                // this is a country we need to parse
                // AF AFG 004 Afghanistan
                c.add(Country.parse(line));
            }
        }
        return c;
    }

    private  CountryUtil();

}