java.util.Properties.storeToXML()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(151)

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

Properties.storeToXML介绍

[英]Writes all properties stored in this instance into the OutputStream in XML representation. The DOCTYPE is

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

If the comment is null, no comment is added to the output. UTF-8 is used as the encoding. The OutputStream is not closed at the end. A call to this method is the same as a call to storeToXML(os,.
[中]将此实例中存储的所有属性以XML表示形式写入OutputStream。DOCTYPE为

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

如果注释为空,则不向输出中添加注释。UTF-8被用作编码。OutputStream在结尾处未关闭。对该方法的调用与对storeToXML(os,。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException {
  props.storeToXML(os, header, encoding);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void storeToXml(Properties props, OutputStream os, String header) throws IOException {
  props.storeToXML(os, header);
}

代码示例来源:origin: org.springframework/spring-core

@Override
public void storeToXml(Properties props, OutputStream os, String header) throws IOException {
  props.storeToXML(os, header);
}

代码示例来源:origin: org.springframework/spring-core

@Override
public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException {
  props.storeToXML(os, header, encoding);
}

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

@Override
public void storeToXML(OutputStream os, String comment) throws IOException {
 if (interned != null) interned.storeToXML(os, comment);
 else super.storeToXML(os, comment);
}

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

@Override
public void storeToXML(OutputStream os, String comment, String encoding)
  throws IOException {
 if (interned != null) interned.storeToXML(os, comment, encoding);
 else super.storeToXML(os, comment, encoding);
}

代码示例来源:origin: alibaba/TProfiler

public void storeToXML(OutputStream os, String comment, String encoding)
 throws IOException {
 delegate.storeToXML(os, comment, encoding);
}

代码示例来源:origin: alibaba/TProfiler

public void storeToXML(OutputStream os, String comment) throws IOException {
 delegate.storeToXML(os, comment);
}

代码示例来源:origin: libgdx/libgdx

public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(new FileOutputStream(file));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new RuntimeException("Error writing preferences: " + file, ex);
  } finally {
    if (out != null)
      try {
        out.close();
      } catch (IOException e) {
      }
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public synchronized void storeToXML( OutputStream os, String comment, String encoding ) throws IOException {
 super.putAll( storageMap );
 super.storeToXML( os, comment, encoding );
 super.clear();
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public synchronized void storeToXML( OutputStream os, String comment ) throws IOException {
 super.putAll( storageMap );
 super.storeToXML( os, comment );
 super.clear();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
WebResult generateBody( HttpServletRequest request, HttpServletResponse response, boolean useXML ) throws Exception {
 ServletOutputStream out = response.getOutputStream();
 Properties kettleProperties = EnvUtil.readProperties( Const.KETTLE_PROPERTIES );
 ByteArrayOutputStream os = new ByteArrayOutputStream();
 if ( useXML ) {
  kettleProperties.storeToXML( os, "" );
 } else {
  kettleProperties.store( os, "" );
 }
 out.write( Encr.encryptPassword( os.toString() ).getBytes() );
 return null;
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void flush () {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(file.write(false));
    properties.storeToXML(out, null);
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error writing preferences: " + file, ex);
  } finally {
    StreamUtils.closeQuietly(out);
  }
}

代码示例来源:origin: stackoverflow.com

Properties props = new Properties() {
  @Override
  public Set<Object> keySet(){
    return Collections.unmodifiableSet(new TreeSet<Object>(super.keySet()));
  }

  @Override
  public synchronized Enumeration<Object> keys() {
    return Collections.enumeration(new TreeSet<Object>(super.keySet()));
  }
};
props.put("B", "Should come second");
props.put("A", "Should come first");
props.storeToXML(new FileOutputStream(new File("sortedProps.xml")), null);
props.store(new FileOutputStream(new File("sortedProps.properties")), null);

代码示例来源:origin: stackoverflow.com

String propFile = "/path/to/file";
Properties props = new Properties();
/*set some properties here*/
Properties tmp = new Properties() {

 @Override
 public Set<Object> keySet()
 {
  return Collections.unmodifiableSet(new TreeSet<Object>(super.keySet()));
 }

};
tmp.putAll(props);
try {
  FileOutputStream xmlStream = new FileOutputStream(propFile);
  /*this comes out SORTED! */
  tmp.storeToXML(xmlStream,"");
} catch (IOException e) {
  e.printStackTrace();
}

相关文章

微信公众号

最新文章

更多