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

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

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

Properties.save介绍

[英]Writes the properties file to the given writer, preserving as much of its structure as possible.
[中]将属性文件写入给定的编写器,尽可能保留其结构。

代码示例

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

/**
 * Store a properties into a output stream, preserving comments, special character, etc.
 * This method is mainly to be compatible with the java.util.Properties class.
 *
 * @param os an output stream.
 * @param comment this parameter is ignored as this Properties
 * @throws IOException If storing fails
 */
public void store(OutputStream os, String comment) throws IOException {
  this.save(os);
}

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

/**
 * Store a properties into a output stream, preserving comments, special character, etc.
 * This method is mainly to be compatible with the java.util.Properties class.
 *
 * @param os an output stream.
 * @param comment this parameter is ignored as this Properties
 * @throws IOException If storing fails
 */
public void store(OutputStream os, String comment) throws IOException {
  this.save(os);
}

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

/**
 * Store a properties into a output stream, preserving comments, special character, etc.
 * This method is mainly to be compatible with the java.util.Properties class.
 *
 * @param os an output stream.
 * @param comment this parameter is ignored as this Properties
 * @throws IOException
 */
public void store(OutputStream os, String comment) throws IOException {
  this.save(os);
}

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

/**
 * Store a properties into a output stream, preserving comments, special character, etc.
 * This method is mainly to be compatible with the java.util.Properties class.
 *
 * @param os an output stream.
 * @param comment this parameter is ignored as this Properties
 * @throws IOException If storing fails
 */
public void store(OutputStream os, String comment) throws IOException {
  this.save(os);
}

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

private void saveUserProperties() {
  try {
    ((Properties)users).save();
  } catch (Exception ex) {
    LOGGER.error("Cannot update users file,", ex);
  }
}

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

public void save(OutputStream os) throws IOException {
  save(new OutputStreamWriter(os, DEFAULT_ENCODING));
}

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

public void save(File location) throws IOException {
  OutputStream os = new FileOutputStream(location);
  try {
    save(os);
  } finally {
    os.close();
  }
}

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

public void save(File location) throws IOException {
  OutputStream os = new FileOutputStream(location);
  try {
    save(os);
  } finally {
    os.close();
  }
}

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

public void save(File location) throws IOException {
  OutputStream os = new FileOutputStream(location);
  try {
    save(os);
  } finally {
    os.close();
  }
}

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

public void save(File location) throws IOException {
  OutputStream os = new FileOutputStream(location);
  try {
    save(os);
  } finally {
    os.close();
  }
}

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

public static byte[] toBytes(Properties source) {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  try {
    source.save(baos);
  } catch (IOException ex) {
    throw new IllegalArgumentException("Cannot store properties", ex);
  }
  return baos.toByteArray();
}

代码示例来源:origin: org.apache.karaf.profile/org.apache.karaf.profile.core

public static byte[] toBytes(Properties source) {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  try {
    source.save(baos);
  } catch (IOException ex) {
    throw new IllegalArgumentException("Cannot store properties", ex);
  }
  return baos.toByteArray();
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

private void markCreated(BundleContext bundleContext) throws IOException {
  File marker = new File(dataDir, ENSEMBLE_MARKER);
  if (!marker.exists() && !marker.getParentFile().exists() && !marker.getParentFile().mkdirs()) {
    throw new IOException("Cannot create marker file");
  }
  org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties(marker);
  props.put("created", "true");
  props.save();
}

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

@Override
public void write(OutputStream out, Dictionary<String, Object> inputDictionary)
  throws IOException {
 notNull(out, "Output stream cannot be null");
 notNull(inputDictionary, "Properties cannot be null");
 final Properties props = new Properties();
 final Enumeration<String> keys = inputDictionary.keys();
 while (keys.hasMoreElements()) {
  String key = keys.nextElement();
  props.put(key, inputDictionary.get(key).toString());
 }
 props.save(out);
}

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

private void markCreated(BundleContext bundleContext) throws IOException {
  File marker = new File(dataDir, ENSEMBLE_MARKER);
  if (!marker.exists() && !marker.getParentFile().exists() && !marker.getParentFile().mkdirs()) {
    throw new IOException("Cannot create marker file");
  }
  org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties(marker);
  props.put("created", "true");
  props.save();
}

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

public void setFramework(FrameworkType framework) {
  if (framework == null) {
    return;
  }
  try {
    Properties properties = loadProps();
    properties.put("karaf.framework", framework.name());
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework: " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.karaf.system/org.apache.karaf.system.core

public void setFramework(FrameworkType framework) {
  if (framework == null) {
    return;
  }
  try {
    Properties properties = loadProps();
    properties.put("karaf.framework", framework.name());
    properties.save();
  } catch (IOException e) {
    throw new RuntimeException("Error setting framework: " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.karaf.jaas/org.apache.karaf.jaas.modules

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

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

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

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

@Override
public void deleteUser(String username) {
  // delete all its groups first, for garbage collection of the groups
  for (GroupPrincipal gp : listGroups(username)) {
    deleteGroup(username, gp.getName());
  }
  users.remove(username);
  try {
    users.save();
  } catch (Exception ex) {
    LOGGER.error("Cannot remove users file,", ex);
  }
}

相关文章