本文整理汇总了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");
}
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
示例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);
}