Package org.nutz.lang.util

Examples of org.nutz.lang.util.MultiLineProperties


   *
   * @param paths
   *            需要加载的Properties文件路径
   */
  public void setPaths(String... paths) {
    mp = new MultiLineProperties();
    List<NutResource> list = Scans.me().loadResource("^.+[.]properties$", paths);
    try {
      if (utf8)
        for (NutResource nr : list)
          mp.load(nr.getReader());
View Full Code Here


        List<NutResource> nrs = entry.getValue();
        String langType = entry.getKey();
        // 循环读取该语言的文件夹
        for (NutResource nr : nrs) {
          // 读取多行属性
          MultiLineProperties p = new MultiLineProperties();
          Reader r = nr.getReader();
          p.load(r);
          r.close();

          // 获取当前语言的 Map
          Map<String, Object> msgs = re.get(langType);
          if (null == msgs) {
            msgs = new NutMessageMap();
            re.put(langType, msgs);
          }

          // 将本地化字符串增加到当前语言
          for (String key : p.keySet()) {
            String str = p.get(key);
            Segment seg = (new CharSegment()).valueOf(str);
            if (seg.keys().isEmpty())
              msgs.put(key, str);
            else
              msgs.put(key, seg);
View Full Code Here

    }

    public PropertiesProxy(InputStream in) {
        this(true);
        try {
            mp = new MultiLineProperties();
            mp.load(new InputStreamReader(in));
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
View Full Code Here

     *
     * @param paths
     *            需要加载的Properties文件路径
     */
    public void setPaths(String... paths) {
        mp = new MultiLineProperties();

        try {
            List<NutResource> list = getResources(paths);
            if (utf8)
                for (NutResource nr : list)
View Full Code Here

    }

    public PropertiesProxy(InputStream in) {
        this(true);
        try {
            mp = new MultiLineProperties();
            mp.load(new InputStreamReader(in));
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
View Full Code Here

     * @since 1.b.50
     */
    public PropertiesProxy(Reader r) {
        this(true);
        try {
            mp = new MultiLineProperties();
            mp.load(r);
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
View Full Code Here

     *
     * @param paths
     *            需要加载的Properties文件路径
     */
    public void setPaths(String... paths) {
        mp = new MultiLineProperties();

        try {
            List<NutResource> list = getResources(paths);
            if (utf8)
                for (NutResource nr : list) {
View Full Code Here

     * @param r
     *            文本输入流
     * @return 自身
     */
    public PropertiesProxy joinAndClose(Reader r) {
        MultiLineProperties mp = new MultiLineProperties();
        try {
            mp.load(r);
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
        finally {
View Full Code Here

                List<NutResource> nrs = entry.getValue();
                String langType = entry.getKey();
                // 循环读取该语言的文件夹
                for (NutResource nr : nrs) {
                    // 读取多行属性
                    MultiLineProperties p = new MultiLineProperties();
                    Reader r = nr.getReader();
                    p.load(r);
                    r.close();

                    // 获取当前语言的 Map
                    Map<String, Object> msgs = re.get(langType);
                    if (null == msgs) {
                        msgs = new NutMessageMap();
                        re.put(langType, msgs);
                    }

                    // 将本地化字符串增加到当前语言
                    for (String key : p.keySet()) {
                        String str = p.get(key);
                        Segment seg = (new CharSegment()).valueOf(str);
                        if (seg.keys().isEmpty())
                            msgs.put(key, str);
                        else
                            msgs.put(key, seg);
View Full Code Here

TOP

Related Classes of org.nutz.lang.util.MultiLineProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.