首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Java读取classpath中的资料

2012-10-08 
Java读取classpath中的文件?/** * 类AppsImport.java的实现描述:TODO 类实现描述 ** @author liangliang.m

Java读取classpath中的文件

?

/** * 类AppsImport.java的实现描述:TODO 类实现描述 *  * @author liangliang.maoll 2011-8-29 上午10:33:06 */public class AppsImport {    private static final BranchService BRANCH_SERVICE = MinasServiceLocator.getBranchService();    private static final String        token          = TokenService.getToken();    private static final String        REPO_INTL      = "intl";    public static void main(String[] args) {        InputStream in = ClassLoader.getSystemResourceAsStream("app_name.txt");        BufferedReader bufferReader = new BufferedReader(new InputStreamReader(in));        String tempString = null;        try {            tempString = bufferReader.readLine();            String[] appNames = tempString.split(",");            for (int i = 0; i < appNames.length; i++) {                appNames[i] = appNames[i].substring(1, appNames[i].length() - 2);            }            bufferReader.close();        } catch (IOException e) {            e.printStackTrace();        }    }}
?

热点排行