org.apache.felix.utils.properties.Properties.load()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.apache.felix.utils.properties.Properties.load()方法的一些代码示例,展示了Properties.load()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.load()方法的具体详情如下:
包路径:org.apache.felix.utils.properties.Properties
类名称:Properties
方法名:load

Properties.load介绍

[英]Reads a properties file and stores its internal structure. The found properties will be added to the associated configuration object.
[中]读取属性文件并存储其内部结构。找到的属性将添加到关联的配置对象中。

代码示例

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public Properties(File location, InterpolationHelper.SubstitutionCallback callback) throws IOException {
  this.location = location;
  this.callback = callback;
  if(location.exists())
    load(location);
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public Properties(File location, InterpolationHelper.SubstitutionCallback callback) throws IOException {
  this.location = location;
  this.callback = callback;
  if(location.exists())
    load(location);
}

代码示例来源:origin: apache/felix

public Properties(File location, InterpolationHelper.SubstitutionCallback callback) throws IOException {
  this.location = location;
  this.callback = callback;
  if(location.exists())
    load(location);
}

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils

public Properties(File location, InterpolationHelper.SubstitutionCallback callback) throws IOException {
  this.location = location;
  this.callback = callback;
  if(location.exists())
    load(location);
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public void load(InputStream is) throws IOException {
  load(new InputStreamReader(is, DEFAULT_ENCODING));
}

代码示例来源:origin: apache/felix

public void load(InputStream is) throws IOException {
  load(new InputStreamReader(is, DEFAULT_ENCODING));
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public void load(InputStream is) throws IOException {
  load(new InputStreamReader(is, DEFAULT_ENCODING));
}

代码示例来源:origin: apache/felix

public void load(File location) throws IOException {
  InputStream is = new FileInputStream(location);
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils

public void load(File location) throws IOException {
  InputStream is = new FileInputStream(location);
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public void load(URL location) throws IOException {
  InputStream is = location.openStream();
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public void load(File location) throws IOException {
  InputStream is = new FileInputStream(location);
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

public void load(File location) throws IOException {
  InputStream is = new FileInputStream(location);
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

public void load(URL location) throws IOException {
  InputStream is = location.openStream();
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: apache/felix

public void load(URL location) throws IOException {
  InputStream is = location.openStream();
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils

public void load(URL location) throws IOException {
  InputStream is = location.openStream();
  try {
    load(is);
  } finally {
    is.close();
  }
}

代码示例来源:origin: jboss-fuse/fabric8

public static Properties toProperties(byte[] source)  {
  try {
    Properties rc = new Properties(false);
    if (source != null) {
      rc.load(new ByteArrayInputStream(source));
    }
    return rc;
  } catch (IOException ex) {
    throw new IllegalArgumentException("Cannot load properties", ex);
  }
}

代码示例来源:origin: codice/ddf

@Override
 public Dictionary<String, Object> read(InputStream in) throws IOException {
  notNull(in, "Input stream cannot be null");
  final Properties props = new Properties();
  props.load(in);
  return new Hashtable<>(props);
 }
}

代码示例来源:origin: apache/karaf

protected static Properties loadPropertiesFile(URL configPropURL) throws Exception {
  try (
    InputStream is = configPropURL.openConnection().getInputStream()
  ){
    Properties configProps = new Properties();
    configProps.load(is);
    return configProps;
  }
  catch (Exception ex) {
    System.err.println("Error loading config properties from " + configPropURL);
    System.err.println("Main: " + ex);
    return null;
  }
}

代码示例来源:origin: apache/karaf

public Properties getProperties() {
  Properties props = new Properties();
  try {
    org.apache.felix.utils.properties.Properties properties
        = new org.apache.felix.utils.properties.Properties();
    properties.load(new StringReader(value));
    for (Map.Entry<String, String> e : properties.entrySet()) {
      props.put(e.getKey(), e.getValue());
    }
  } catch (IOException e) {
    // ignore??
  }
  return props;
}

代码示例来源:origin: apache/karaf

private Properties loadPaxLoggingConfig() {
  Properties props = new Properties();
  FileInputStream fis = null;
  try {
    fis = new FileInputStream(log4jConfigPath);
    props.load(fis);
  } catch (Exception e) {
    // Ignore
  } finally {
    close(fis);
  }
  return props;
}

相关文章