当前位置: 首页>>代码示例>>Java>>正文


Java Properties.storeToXML方法代码示例

本文整理汇总了Java中java.util.Properties.storeToXML方法的典型用法代码示例。如果您正苦于以下问题:Java Properties.storeToXML方法的具体用法?Java Properties.storeToXML怎么用?Java Properties.storeToXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Properties的用法示例。


在下文中一共展示了Properties.storeToXML方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConnectionProperties

import java.util.Properties; //导入方法依赖的package包/类
@Test
public void getConnectionProperties() throws Exception {
    // given
    BillingAdapter ba = spy(new BillingAdapter());
    Properties props = createConnectionProperties("FileAdapter");
    try (ByteArrayOutputStream stream = new ByteArrayOutputStream();) {
        props.storeToXML(stream, null, StandardCharsets.UTF_8.toString());
        ba.setConnectionProperties(stream.toString());
    }

    // when
    Properties p = PluginServiceFactory.getConnectionProperties(ba);

    // then
    assertEquals(createConnectionProperties("FileAdapter"), p);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:PluginServiceFactoryTest.java

示例2: saveProperties

import java.util.Properties; //导入方法依赖的package包/类
protected void saveProperties(Properties properties, FileObject storage) throws IOException {
    synchronized (this) {
        OutputStream os = storage.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(os);
        try {
            properties.storeToXML(bos, ""); // NOI18N
        } finally {
            if (bos != null) bos.close();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ProfilerStorageProvider.java

示例3: saveFoldersList

import java.util.Properties; //导入方法依赖的package包/类
public boolean saveFoldersList(ArrayList<String> list) throws FileNotFoundException, IOException{
        Properties p = getFoldersList(); 
        String pa = "";
        if(new File(pa).isFile()){
            pa = new File(pa).getParent();
        }
        FileOutputStream f = new FileOutputStream(new File(PATH));
        if(!p.containsKey(pa)){
            p.setProperty(new File(pa).getAbsolutePath(),new File(pa).getName());
        }else{
            return false;
        }
        p.storeToXML(f,null);
        return true;
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:16,代码来源:XMLManager.java

示例4: convertPropertiesToXML

import java.util.Properties; //导入方法依赖的package包/类
String convertPropertiesToXML(Properties properties)
        throws RuntimeException {
    String xmlString;
    try (OutputStream out = new ByteArrayOutputStream()) {
        properties.storeToXML(out, null, "UTF-8");
        xmlString = out.toString();
    } catch (IOException e) {
        throw new RuntimeException();
    }
    return xmlString;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:ServiceInstance.java

示例5: convertPropertiesToXML

import java.util.Properties; //导入方法依赖的package包/类
String convertPropertiesToXML(Properties properties) {
    String xmlString = null;
    try (OutputStream out = new ByteArrayOutputStream()) {
        properties.storeToXML(out, null, "UTF-8");
        xmlString = out.toString();
    } catch (IOException e) {
        LOGGER.logError(Log4jLogger.SYSTEM_LOG, e,
                LogMessageIdentifier.ERROR);
    }
    return xmlString;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:Operation.java

示例6: create

import java.util.Properties; //导入方法依赖的package包/类
public static DataStoreAccesor create ( final File basePath, final long time, final TimeUnit unit, final int count, final DataFilePool pool ) throws Exception
{
    if ( basePath.exists () )
    {
        throw new IllegalArgumentException ( String.format ( "'%s' must not exists", basePath ) );
    }

    if ( !basePath.getParentFile ().isDirectory () )
    {
        throw new IllegalArgumentException ( String.format ( "Parent directory '%s' must exists and must be a directory", basePath.getParentFile () ) );
    }

    if ( !basePath.mkdir () )
    {
        throw new IllegalArgumentException ( String.format ( "Unable to create directory %s", basePath ) );
    }

    final Properties p = new Properties ();
    p.put ( "time", "" + time );
    p.put ( "unit", unit.name () );
    p.put ( "count", "" + count );
    p.put ( "version", "1" );

    try
    {
        p.storeToXML ( new FileOutputStream ( new File ( basePath, "settings.xml" ) ), "Eclipse SCADA HDS Settings" );
    }
    catch ( final Exception e )
    {
        // try to delete directory
        basePath.delete ();
        throw new IllegalStateException ( e );
    }

    return new DataStoreAccesor ( basePath, pool );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:37,代码来源:DataStoreAccesor.java

示例7: create

import java.util.Properties; //导入方法依赖的package包/类
public static void create ( final String id, final File file, final StorageConfiguration configuration, final DataFilePool pool ) throws Exception
{
    file.mkdir ();

    final Properties p = new Properties ();
    p.put ( "id", id );
    p.storeToXML ( new FileOutputStream ( new File ( file, "settings.xml" ) ), "Eclipse SCADA HD HDS Storage Settings" );

    DataStoreAccesor.create ( new File ( file, "native" ), configuration.getTimeSlice (), TimeUnit.MILLISECONDS, configuration.getCount (), pool );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:StorageHelper.java

示例8: convertPropertiesToXML

import java.util.Properties; //导入方法依赖的package包/类
static String convertPropertiesToXML(Properties properties)
        throws IOException {
    if (properties != null) {
        String xmlString;
        try (OutputStream out = new ByteArrayOutputStream()) {
            properties.storeToXML(out, null, "UTF-8");
            xmlString = out.toString();
        }
        return xmlString;
    }
    return null;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:13,代码来源:BillingAdapterAssembler.java

示例9: setProperty

import java.util.Properties; //导入方法依赖的package包/类
public void setProperty(final String key, final String value) {
    Properties properties = getProperties();
    properties.setProperty(key, value);
    final OutputStream out = setNamedData(PROPERTIES);
    try {
        properties.storeToXML(out, "");
        out.close();
    } catch (final IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:12,代码来源:RolesView.java

示例10: setProperties

import java.util.Properties; //导入方法依赖的package包/类
@Override
public void setProperties(String path, Properties properties) {
    OutputStream out = getOutputStream(path);
    try {
        properties.storeToXML(out, "Path: " + path);
        out.close();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:12,代码来源:AbstractEngine.java

示例11: writeToXML

import java.util.Properties; //导入方法依赖的package包/类
@Override
public String writeToXML(Properties p) throws IOException {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    p.storeToXML(baos, "Test 8016344");
    return baos.toString();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:LoadAndStoreXMLWithDefaults.java

示例12: writeToXML

import java.util.Properties; //导入方法依赖的package包/类
static String writeToXML(Properties props) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    props.storeToXML(baos, "Test 8016344");
    return baos.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:LoadAndStoreXMLWithDefaults.java

示例13: storeToXml

import java.util.Properties; //导入方法依赖的package包/类
@Override
public void storeToXml(Properties props, OutputStream os, String header) throws IOException {
	props.storeToXML(os, header);
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:5,代码来源:DefaultPropertiesPersister.java


注:本文中的java.util.Properties.storeToXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。