當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。