Java 8 Properties - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Properties class.

This code example shows how to use the following methods:
        ProjectManager.singleton.setBusy(true); 
        try { 
            Project project = getProject(request); 
             
            AbstractOperation op = new ImportQADataOperation(); 
            Process process = op.createProcess(project, new Properties()); 
             
            performProcessAndRespond(request, response, project, process); 
        } catch (Exception e) { 
            respondException(response, e); 
        } finally { 
            ProjectManager.singleton.setBusy(false); 
        } 
    } 
} 
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load
   private Properties load(String resource)
   { 
      InputStream propsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
      if(propsStream != null)
      { 
         Properties props = new Properties();
         try 
         { 
            props.load(propsStream);
            return props;
         } 
         catch (Exception e) 
         { 
            throw new RuntimeException("Could not load properties", e);
         } 
      } 
      return null; 
   } 
} 
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
            if (job == null) {
                writer.key("code"); writer.value("error");
                writer.key("message"); writer.value("No such import job");
            } else { 
                writer.key("code"); writer.value("ok");
                writer.key("job"); job.write(writer, new Properties());
            } 
            writer.endObject();
        } catch (JSONException e) {
            throw new ServletException(e);
        } finally { 
            w.flush();
            w.close();
        } 
    } 
} 
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load
     * @return The Properties object 
     */ 
    public static Properties readUtf8Properties(InputStream is) {
        Properties properties = new OrderSafeProperties();
        try { 
            properties.load(is);
            is.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } 
        return properties;
    } 
 
    /** 
     * Read the Stream content as a string (use utf-8) 
     * @param is The stream to read 
     * @return The String content 
     */ 
    public static String readContentAsString(InputStream is) {
        return readContentAsString(is, "utf-8");
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load
	 * 
	 * @param filename the filename of the properties file to load 
	 * @return a new java.util.Properties instance 
	 */ 
	public static Properties getProperties(String filename) {
		Properties props = new Properties();
 
		if (filename != null && filename.trim().length() > 0) {
			FileInputStream fis = null;
 
			try { 
				fis = new FileInputStream(filename);
				props.load(fis);
			} catch (IOException e) {
				System.err.println("Could not load properties file: " + filename);
			} finally { 
				if (fis != null) {
					try { 
						fis.close();
					} catch (IOException e) {
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        } 
    } 
     
    @BeforeMethod 
    public void SetUp() { 
        bindings = new Properties();
    } 
 
    @AfterMethod 
    public void TearDown() { 
        bindings = null;
    } 
     
    /** 
     * Lookup a control function by name and invoke it with a variable number of args 
     */ 
    private static Object invoke(String name,Object... args) {
        // registry uses static initializer, so no need to set it up 
        Function function = ControlFunctionRegistry.getFunction(name);
        if (function == null) {
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put, containsKey, get, putAll
    @TargetsContainer("iiop-client") 
    public static Archive<?> clientDeployment() { 
 
        String ejbJar = FileUtils.readFile(TransactionIIOPInvocationTestCase.class, "ejb-jar.xml");
 
        final Properties properties = new Properties();
        properties.putAll(System.getProperties());
        if(properties.containsKey("node1")) {
            properties.put("node1", NetworkUtils.formatPossibleIpv6Address((String) properties.get("node1")));
        } 
 
        final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "client.jar");
        jar.addClasses(ClientEjb.class, IIOPTransactionalHome.class,
                IIOPTransactionalRemote.class, TransactionIIOPInvocationTestCase.class 
                , IIOPTransactionalStatefulHome.class, IIOPTransactionalStatefulRemote.class) 
                .addAsManifestResource(TransactionIIOPInvocationTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml")
                .addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(ejbJar, properties)), "ejb-jar.xml");
        return jar;
    } 
 

9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
     * @param hostName 
     * @return 
     * @throws UnknownHostException 
     */ 
    public static Properties createEjbClientConfiguration(String hostName) throws UnknownHostException {
        final Properties pr = new Properties();
        pr.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
        pr.put("remote.connections", "default");
        pr.put("remote.connection.default.host", hostName);
        pr.put("remote.connection.default.port", "8080");
        pr.put("remote.connection.default.username", CONNECTION_USERNAME);
        pr.put("remote.connection.default.password", CONNECTION_PASSWORD);
        return pr;
    } 
 
} 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:load
            setDefault(); 
        } else { 
            FileInputStream fis = null;
            try { 
                fis = new FileInputStream(SETTINGS);
                m_settings = new Properties();
                m_settings.load(fis);
            } finally { 
                if (fis != null) {
                    fis.close();
                } 
            } 
        } 
    } 
 
    public static void store() throws IOException { 
        if (!SETTINGS.exists()) {
            if (SETTINGS.getParentFile() != null) {
                SETTINGS.getParentFile().mkdirs();
            } 
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		return (props!=null)?props.getProperty(key):null;
	} 
	 
	public Properties get() {
		FileInputStream fis = null;
		Properties props = new Properties();
		try{ 
			//读取files目录下的config 
			//fis = activity.openFileInput(APP_CONFIG); 
			 
			//读取app_config目录下的config 
			File dirConf = mContext.getDir(APP_CONFIG, Context.MODE_PRIVATE);
			fis = new FileInputStream(dirConf.getPath() + File.separator + APP_CONFIG);
			 
			props.load(fis);
		}catch(Exception e){
		}finally{ 
			try { 
				fis.close();
			} catch (Exception e) {}
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Java 8 Properties Questions & Answers:

See Code Examples for Java 8 Properties Methods: