Here you can find the source of getReader(final String fileName)
Parameter | Description |
---|---|
fileName | File name |
public static BufferedReader getReader(final String fileName)
//package com.java2s; /*L/*from w ww.java 2s. c om*/ * Copyright RTI International * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/webgenome/LICENSE.txt for details. */ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class Main { /** * Get input reader to given file. * @param fileName File name * @return Reader */ public static BufferedReader getReader(final String fileName) { InputStream stream = getInputStream(fileName); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); return reader; } /** * Get input stream for specified file name. * @param fileName Relative file name (not full path) * @return An input stream */ public static InputStream getInputStream(final String fileName) { Thread curThread = Thread.currentThread(); ClassLoader loader = curThread.getContextClassLoader(); return loader.getResourceAsStream(fileName); } }