Пример #1
0
  public static void main(String[] args) {
    dumpSystemInfo();

    Set<?> keys = System.getProperties().keySet();

    @SuppressWarnings("unchecked")
    List<String> list = createArrayList((Set<String>) keys);

    Collections.sort(list);

    for (String key : list) {
      String value = System.getProperty(key);

      System.out.println(key + " = " + defaultIfNull(StringEscapeUtil.escapeJava(value), "[n/a]"));
    }
  }
Пример #2
0
 /**
  * 输出到<code>StringBuilder</code>。
  *
  * @param buffer <code>StringBuilder</code>对象
  * @param caption 标题
  * @param value 值
  */
 private static void append(StringBuilder buffer, String caption, String value) {
   buffer
       .append(caption)
       .append(defaultIfNull(StringEscapeUtil.escapeJava(value), "[n/a]"))
       .append("\n");
 }