org.jgroups.util.Util.getResourceAsStream()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(236)

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

Util.getResourceAsStream介绍

暂无

代码示例

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

  1. protected static InputStream findFile(String filename) {
  2. try {return new FileInputStream(filename);} catch(FileNotFoundException e) {}
  3. File file=new File(filename);
  4. String name=file.getName();
  5. try {return new FileInputStream(name);} catch(FileNotFoundException e) {}
  6. try {
  7. String home_dir=System.getProperty("user.home");
  8. filename=home_dir + File.separator + name;
  9. try {return new FileInputStream(filename);} catch(FileNotFoundException e) {}
  10. }
  11. catch(Throwable t) {
  12. }
  13. return Util.getResourceAsStream(name, MPerf.class);
  14. }

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

  1. public static InputStream getForkStream(String config) throws IOException {
  2. InputStream configStream = null;
  3. try {
  4. configStream=new FileInputStream(config);
  5. }
  6. catch(FileNotFoundException | AccessControlException fnfe) { // catching ACE fixes http://jira.jboss.com/jira/browse/JGRP-94
  7. }
  8. // Check to see if the properties string is a URL.
  9. if(configStream == null) {
  10. try {
  11. configStream=new URL(config).openStream();
  12. }
  13. catch (MalformedURLException ignored) {
  14. }
  15. }
  16. // Check to see if the properties string is the name of a resource, e.g. udp.xml.
  17. if(configStream == null)
  18. configStream=Util.getResourceAsStream(config, ConfiguratorFactory.class);
  19. return configStream;
  20. }

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

  1. /**
  2. * try to read the magic number configuration file as a Resource form the classpath using getResourceAsStream
  3. * if this fails this method tries to read the configuration file from mMagicNumberFile using a FileInputStream (not in classpath but somewhere else in the disk)
  4. *
  5. * @return an array of ClassMap objects that where parsed from the file (if found) or an empty array if file not found or had en exception
  6. */
  7. protected static List<Triple<Short,String,Boolean>> readMappings(String name) throws Exception {
  8. InputStream stream;
  9. stream=Util.getResourceAsStream(name, ClassConfigurator.class);
  10. // try to load the map from file even if it is not a Resource in the class path
  11. if(stream == null)
  12. stream=new FileInputStream(name);
  13. return parse(stream);
  14. }

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

  1. configStream=Util.getResourceAsStream(properties, ConfiguratorFactory.class);
  2. return configStream;

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

  1. input=Util.getResourceAsStream(keystore_name, getClass());

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. protected static InputStream findFile(String filename) {
  2. try {return new FileInputStream(filename);} catch(FileNotFoundException e) {}
  3. File file=new File(filename);
  4. String name=file.getName();
  5. try {return new FileInputStream(name);} catch(FileNotFoundException e) {}
  6. try {
  7. String home_dir=System.getProperty("user.home");
  8. filename=home_dir + File.separator + name;
  9. try {return new FileInputStream(filename);} catch(FileNotFoundException e) {}
  10. }
  11. catch(Throwable t) {
  12. }
  13. return Util.getResourceAsStream(name, MPerf.class);
  14. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. public static InputStream getForkStream(String config) throws IOException {
  2. InputStream configStream = null;
  3. try {
  4. configStream=new FileInputStream(config);
  5. }
  6. catch(FileNotFoundException | AccessControlException fnfe) { // catching ACE fixes http://jira.jboss.com/jira/browse/JGRP-94
  7. }
  8. // Check to see if the properties string is a URL.
  9. if(configStream == null) {
  10. try {
  11. configStream=new URL(config).openStream();
  12. }
  13. catch (MalformedURLException ignored) {
  14. }
  15. }
  16. // Check to see if the properties string is the name of a resource, e.g. udp.xml.
  17. if(configStream == null)
  18. configStream=Util.getResourceAsStream(config, ConfiguratorFactory.class);
  19. return configStream;
  20. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. /**
  2. * try to read the magic number configuration file as a Resource form the classpath using getResourceAsStream
  3. * if this fails this method tries to read the configuration file from mMagicNumberFile using a FileInputStream (not in classpath but somewhere else in the disk)
  4. *
  5. * @return an array of ClassMap objects that where parsed from the file (if found) or an empty array if file not found or had en exception
  6. */
  7. protected static List<Triple<Short,String,Boolean>> readMappings(String name) throws Exception {
  8. InputStream stream;
  9. stream=Util.getResourceAsStream(name, ClassConfigurator.class);
  10. // try to load the map from file even if it is not a Resource in the class path
  11. if(stream == null)
  12. stream=new FileInputStream(name);
  13. return parse(stream);
  14. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. configStream=Util.getResourceAsStream(properties, ConfiguratorFactory.class);
  2. return configStream;

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. InputStream stream=Util.getResourceAsStream(mMagicNumberFile, this.getClass());

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. configStream=Util.getResourceAsStream(properties, ConfiguratorFactory.class);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. input=Util.getResourceAsStream(keystore_name, getClass());

代码示例来源:origin: org.jboss.cluster/jboss-ha-server-core

  1. input=Util.getResourceAsStream((String)properties, ConfiguratorFactory.class);

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. input=Util.getResourceAsStream((String)properties, ConfiguratorFactory.class);

相关文章

Util类方法