當前位置: 首頁>>代碼示例>>Java>>正文


Java Properties.list方法代碼示例

本文整理匯總了Java中java.util.Properties.list方法的典型用法代碼示例。如果您正苦於以下問題:Java Properties.list方法的具體用法?Java Properties.list怎麽用?Java Properties.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Properties的用法示例。


在下文中一共展示了Properties.list方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addVersionInfo

import java.util.Properties; //導入方法依賴的package包/類
public void addVersionInfo() {
    Properties props = new Properties();
    // when running from webstart  we are not allowed to open a file on the local file system, but we can
    // get a the contents of a resource, which in this case is the echo'ed date stamp written by ant on the last build
    ClassLoader cl = this.getClass().getClassLoader(); // get this class'es class loader
    addLogInfo("\nLoading version info from resource " + AEViewerAboutDialog.VERSION_FILE);
    URL versionURL = cl.getResource(AEViewerAboutDialog.VERSION_FILE); // get a URL to the time stamp file
    addLogInfo("\nVersion URL=" + versionURL + "\n");

    if (versionURL != null) {
        try {
            Object urlContents = versionURL.getContent();
            BufferedReader in = null;
            if (urlContents instanceof InputStream) {
                props.load((InputStream) urlContents);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
        PrintWriter ps = new PrintWriter(baos);
        props.list(ps);
        ps.flush();
        try {
            addLogInfo("\n" + baos.toString("UTF-8"));
        } catch (UnsupportedEncodingException ex) {
            System.err.println("cannot encode version information in LoggingWindow.addVersionInfo: " + ex.toString());
        }
    } else {
        props.setProperty("version", "missing file " + AEViewerAboutDialog.VERSION_FILE + " in jAER.jar");
    }

}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:34,代碼來源:LoggingWindow.java

示例2: main

import java.util.Properties; //導入方法依賴的package包/類
public static void main(String[] args) {
    Solution solution = new Solution();
    Properties properties = solution.getProperties("4.JavaCollections/src/com/javarush/task/task31/task3109/properties.xml");
    properties.list(System.out);

    properties = solution.getProperties("4.JavaCollections/src/com/javarush/task/task31/task3109/properties.txt");
    properties.list(System.out);

    properties = solution.getProperties("4.JavaCollections/src/com/javarush/task/task31/task3109/notExists");
    properties.list(System.out);
}
 
開發者ID:avedensky,項目名稱:JavaRushTasks,代碼行數:12,代碼來源:Solution.java

示例3: main

import java.util.Properties; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
	SourceStream src = new FileSourceStream("UTF-8", args[0]);
	Properties defaultConfig = new Properties();
	Properties options = new Properties();
	readConfig(src, defaultConfig, options);
	defaultConfig.list(System.err);
	options.list(System.err);
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:9,代碼來源:TestReadConfig.java

示例4: setUpClientVM

import java.util.Properties; //導入方法依賴的package包/類
public void setUpClientVM(String host, int port, boolean cacheServerSslenabled,
    boolean cacheServerSslRequireAuth, String keyStore, String trustStore, boolean subscription) {

  Properties gemFireProps = new Properties();

  String cacheServerSslprotocols = "any";
  String cacheServerSslciphers = "any";

  String keyStorePath =
      TestUtil.getResourcePath(CacheServerSSLConnectionDUnitTest.class, keyStore);
  String trustStorePath =
      TestUtil.getResourcePath(CacheServerSSLConnectionDUnitTest.class, trustStore);
  // using new server-ssl-* properties
  gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
  gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
  gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
  gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));

  gemFireProps.put(SERVER_SSL_KEYSTORE_TYPE, "jks");
  gemFireProps.put(SERVER_SSL_KEYSTORE, keyStorePath);
  gemFireProps.put(SERVER_SSL_KEYSTORE_PASSWORD, "password");
  gemFireProps.put(SERVER_SSL_TRUSTSTORE, trustStorePath);
  gemFireProps.put(SERVER_SSL_TRUSTSTORE_PASSWORD, "password");

  StringWriter sw = new StringWriter();
  PrintWriter writer = new PrintWriter(sw);
  gemFireProps.list(writer);
  System.out.println("Starting client ds with following properties \n" + sw.getBuffer());

  ClientCacheFactory clientCacheFactory = new ClientCacheFactory(gemFireProps);
  clientCacheFactory.setPoolSubscriptionEnabled(subscription).addPoolServer(host, port);
  clientCache = clientCacheFactory.create();

  ClientRegionFactory<String, String> regionFactory =
      clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY);
  Region<String, String> region = regionFactory.create("serverRegion");
  assertNotNull(region);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:39,代碼來源:CacheServerSSLConnectionDUnitTest.java

示例5: setUpServerVM

import java.util.Properties; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
public void setUpServerVM(boolean cacheServerSslenabled) throws Exception {
  Properties gemFireProps = new Properties();

  String cacheServerSslprotocols = "any";
  String cacheServerSslciphers = "any";
  boolean cacheServerSslRequireAuth = false;
  gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
  gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
  gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
  gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));

  String keyStore = TestUtil.getResourcePath(SSLNoClientAuthDUnitTest.class, DEFAULT_STORE);
  String trustStore = TestUtil.getResourcePath(SSLNoClientAuthDUnitTest.class, DEFAULT_STORE);
  gemFireProps.put(SERVER_SSL_KEYSTORE_TYPE, "jks");
  gemFireProps.put(SERVER_SSL_KEYSTORE, keyStore);
  gemFireProps.put(SERVER_SSL_KEYSTORE_PASSWORD, "password");
  gemFireProps.put(SERVER_SSL_TRUSTSTORE, trustStore);
  gemFireProps.put(SERVER_SSL_TRUSTSTORE_PASSWORD, "password");

  StringWriter sw = new StringWriter();
  PrintWriter writer = new PrintWriter(sw);
  gemFireProps.list(writer);
  System.out.println("Starting cacheserver ds with following properties \n" + sw);
  createCache(gemFireProps);

  RegionFactory factory = cache.createRegionFactory(RegionShortcut.REPLICATE);
  Region r = factory.create("serverRegion");
  r.put("serverkey", "servervalue");
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:31,代碼來源:SSLNoClientAuthDUnitTest.java

示例6: setUpClientVM

import java.util.Properties; //導入方法依賴的package包/類
public void setUpClientVM(String host, int port, boolean cacheServerSslenabled,
    boolean cacheServerSslRequireAuth, String keyStore, String trustStore) {

  Properties gemFireProps = new Properties();

  String cacheServerSslprotocols = "any";
  String cacheServerSslciphers = "any";

  String keyStorePath = TestUtil.getResourcePath(SSLNoClientAuthDUnitTest.class, keyStore);
  String trustStorePath = TestUtil.getResourcePath(SSLNoClientAuthDUnitTest.class, trustStore);
  // using new server-ssl-* properties
  gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
  gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
  gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
  gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));

  gemFireProps.put(SERVER_SSL_KEYSTORE_TYPE, "jks");
  gemFireProps.put(SERVER_SSL_KEYSTORE, keyStorePath);
  gemFireProps.put(SERVER_SSL_KEYSTORE_PASSWORD, "password");
  gemFireProps.put(SERVER_SSL_TRUSTSTORE, trustStorePath);
  gemFireProps.put(SERVER_SSL_TRUSTSTORE_PASSWORD, "password");

  StringWriter sw = new StringWriter();
  PrintWriter writer = new PrintWriter(sw);
  gemFireProps.list(writer);
  System.out.println("Starting client ds with following properties \n" + sw.getBuffer());

  ClientCacheFactory clientCacheFactory = new ClientCacheFactory(gemFireProps);
  clientCacheFactory.addPoolServer(host, port);
  clientCache = clientCacheFactory.create();

  ClientRegionFactory<String, String> regionFactory =
      clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY);
  Region<String, String> region = regionFactory.create("serverRegion");
  assertNotNull(region);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:37,代碼來源:SSLNoClientAuthDUnitTest.java


注:本文中的java.util.Properties.list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。