コード例 #1
0
 public void loadFromFile() throws IOException {
   InputStream fis = new FileInputStream(basePath + slh_filename);
   InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
   BufferedReader br = new BufferedReader(isr);
   String line;
   int counter = 0;
   while ((line = br.readLine()) != null) {
     String[] args = line.split(";");
     Station station = new Station(args[0], args[1]);
     try {
       station.lantitude = Double.valueOf(args[2]);
     } catch (NumberFormatException nfe) {
       station.lantitude = null;
     }
     try {
       station.longtitude = Double.valueOf(args[3]);
     } catch (NumberFormatException nfe) {
       station.longtitude = null;
     }
     stationList.add(station);
     counter++;
   }
   br.close();
   System.out.println("stationList = " + stationList);
   System.out.println("counter = " + counter);
 }