Here you can find the source of openReader(String fname)
public static BufferedReader openReader(String fname) throws IOException
//package com.java2s; /**//w ww. j a va2 s. c om * This software is released under the University of Illinois/Research and Academic Use License. See * the LICENSE file in the root folder for details. Copyright (c) 2016 * * Developed by: The Cognitive Computation Group University of Illinois at Urbana-Champaign * http://cogcomp.cs.illinois.edu/ */ import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static BufferedReader openReader(String fname) throws IOException { BufferedReader reader; InputStream is = ClassLoader.getSystemResourceAsStream(fname); if (is == null) { // try with a leading slash is = ClassLoader.getSystemResourceAsStream("/" + fname); if (is == null) is = new FileInputStream(fname); } reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); return reader; } }