属性文件的几种读取方法
编程技术  /  houtizong 发布于 3年前   66
Message.javapackage com.jctx.dnrm; import java.util.MissingResourceException;import java.util.ResourceBundle; public class Message {//定义属性文件的路径 private static final String BUNDLE_NAME = "com.jctx.dnrm.dnrmMessages"; private static final ResourceBundle Resource_Bundle = ResourceBundle.getBundle(BUNDLE_NAME); private Message(){} public static String getString(String key){ try{ return Resource_Bundle.getString(key); } catch (MissingResourceException e){ return "!" + key + "!"; } }}
import org.eclipse.osgi.util.NLS; public class LogicMessages extends NLS {public static String AddCommand_Label;static { NLS.initializeMessages("org.eclipse.gef.examples.logicdesigner.messages",LogicMessages.class); //$NON-NLS-1$}}
package com.jctx.trms; import java.util.MissingResourceException;import org.eclipse.core.runtime.Platform;import org.osgi.framework.Bundle; public interface LogicMessages { static class Helper { public static String getString(String key) { Bundle bundle = Platform.getBundle("com.jctx.trms"); try { return Platform.getResourceString(bundle,key); } catch (MissingResourceException e) { return key; } } }}
package org.eclipse.ui.examples.rcp.browser; public interface IBrowserConstants { public static final String BROWSER_PERSPECTIVE_ID = PLUGIN_ID + ".browserPerspective"; //$NON-NLS-1$ public static final String BROWSER_VIEW_ID = PLUGIN_ID + ".browserView"; public static final String HISTORY_VIEW_ID = PLUGIN_ID + ".historyView"; public static final String COMMAND_PREFIX = PLUGIN_ID + ".commands."; //$NON-NLS-1$ public static final String PREF_HOME_PAGE = "homePage"; //$NON-NLS-1$ public static final String MEMENTO_URL = "url"; //$NON-NLS-1$}
Properties pr = newProperties();InputStream input = SimpleAgent.class.getResourceAsStream("mib.Properties");pr.load(input)
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接