コード例 #1
0
  private Reader input() {
    String path =
        System.getProperty("user.home") + File.separator + "dev" + File.separator + "data";
    final File f = new File(path + File.separator + "worldcitiespop.txt");

    try {
      return new InputStreamReader(new FileInputStream(f), "ISO-8859-1");
    } catch (FileNotFoundException e) {
      throw new IllegalStateException(e);
    } catch (UnsupportedEncodingException e) {
      throw new IllegalStateException(e);
    }
  }
コード例 #2
0
  public static void execute(String description, Runnable process) {
    long start = System.currentTimeMillis();

    process.run();
    System.out.println(description + " took " + (System.currentTimeMillis() - start) + " ms.");
  }