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

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

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

Properties.escapeKey介绍

[英]Escape the separators in the key.
[中]从钥匙里的隔板里逃出来。

代码示例

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

public String put(String key, List<String> commentLines, List<String> valueLines) {
  commentLines = new ArrayList<String>(commentLines);
  valueLines = new ArrayList<String>(valueLines);
  String escapedKey = escapeKey(key);
  int lastLine = valueLines.size() - 1;
  if (valueLines.isEmpty()) {
    valueLines.add(escapedKey + "=");
  } else if (!valueLines.get(0).trim().startsWith(escapedKey)) {
    valueLines.set(0, escapedKey + " = " + escapeJava(valueLines.get(0)) + (0 < lastLine? "\\": ""));
  }
  for (int i = 1; i < valueLines.size(); i++) {
    valueLines.set(i, escapeJava(valueLines.get(i)) + (i < lastLine? "\\": ""));
  }
  StringBuilder value = new StringBuilder();
  for (String line: valueLines) {
    value.append(line);
  }
  this.layout.put(key, new Layout(commentLines, valueLines));
  return storage.put(key, unescapeJava(value.toString()));
}

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

public String put(String key, List<String> commentLines, List<String> valueLines) {
  commentLines = new ArrayList<String>(commentLines);
  valueLines = new ArrayList<String>(valueLines);
  String escapedKey = escapeKey(key);
  StringBuilder sb = new StringBuilder();
  int lastLine = valueLines.size() - 1;

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

public String put(String key, List<String> commentLines, List<String> valueLines) {
  commentLines = new ArrayList<String>(commentLines);
  valueLines = new ArrayList<String>(valueLines);
  String escapedKey = escapeKey(key);
  StringBuilder sb = new StringBuilder();
  int lastLine = valueLines.size() - 1;

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

public String put(String key, List<String> commentLines, List<String> valueLines) {
  commentLines = new ArrayList<String>(commentLines);
  valueLines = new ArrayList<String>(valueLines);
  String escapedKey = escapeKey(key);
  StringBuilder sb = new StringBuilder();
  int lastLine = valueLines.size() - 1;

相关文章