Package java.util

Examples of java.util.Properties.store()


      // 从输入流中读取属性列表(键和元素对)
      Properties prop = getProperties();
      prop.setProperty(key, value);
      String path = PropertiesUtils.class.getResource("/config.properties").getPath();
      FileOutputStream outputFile = new FileOutputStream(path);
      prop.store(outputFile, "modify");
      outputFile.close();
      outputFile.flush();
    } catch (Exception e) {
    }
  }
View Full Code Here


            if (!event.startsWith("current")) {
                p.setProperty(event, data.get(event).toString());
            }
        }
        try {
            p.store(output, this.getClass().getName());
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    defaultProperties.setProperty(WroTagLibConfig.InitParam.BASE_URL.getKey(), values[0]);
    defaultProperties.setProperty(WroTagLibConfig.InitParam.LESS_PATH.getKey(), values[1]);
    defaultProperties.setProperty(WroTagLibConfig.InitParam.RESOURCE_DOMAIN.getKey(), values[2]);

    FileWriter writer = new FileWriter(propertiesFile);
    defaultProperties.store(writer, null);
    writer.close();
  }


  @Test
View Full Code Here

                    for (int i = 0; i < count; i++) {
                        String name = props.getProperty("item." + i + ".name");
                        if (name.equals(instanceName)) {
                            props.setProperty("item." + i + ".pid", pid);
                            FileOutputStream fos = new FileOutputStream(propertiesFile);
                            props.store(fos, null);
                            fis.close();
                            fos.close();
                            return;
                        }
                    }
View Full Code Here

                    props.setProperty("item.0.name", instanceName);
                    props.setProperty("item.0.loc", karafHome.getAbsolutePath());
                    props.setProperty("item.0.pid", pid);
                    props.setProperty("item.0.root", "true");
                    FileOutputStream fos = new FileOutputStream(propertiesFile);
                    props.store(fos, null);
                    fos.close();
                }
            }
        } catch (Exception e) {
            System.err.println("Unable to update instance pid: " + e.getMessage());
View Full Code Here

                String existingFeatureRepos = properties.containsKey(FEATURES_REPOSITORIES)? properties.getProperty(FEATURES_REPOSITORIES) + ",": "";
                existingFeatureRepos = existingFeatureRepos + url.toString();
                properties.setProperty(FEATURES_REPOSITORIES, existingFeatureRepos);
                FileOutputStream out = new FileOutputStream(featuresCfgFile);
                try {
                    properties.store(out, "Features Service config");
                } finally {
                    out.close();
                }
            }
        }
View Full Code Here

                    Entry entry = (Entry) iter.next();
                    store.setProperty(count++ + "-" + (String) entry.getKey(),
                        getEncoded(entry.getValue()));
                }

                store.store(out, null);
            }
            catch (IOException ex)
            {
                org = ex;
                throw ex;
View Full Code Here

            {
                props.setProperty(Integer.toString(i), array[i].toString());
            }

            ByteArrayOutputStream tmp = new ByteArrayOutputStream();
            props.store(tmp, null);
            return new String(tmp.toByteArray());
        }

        return target.toString();
    }
View Full Code Here

                {
                    stringProperties.setProperty( key, value );
                }
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            stringProperties.store( out, null ); // properties encoding is 8859_1
            buf.append( out.toString( "8859_1" ) );
            buf.append( "#-----------------------------------------------------------------------" + NL );
        }
        catch ( Throwable e )
        {
View Full Code Here

        Properties p = new Properties();
        p.put( "version", currentProject.getVersion() );
        p.put( "groupId", currentProject.getGroupId() );
        p.put( "artifactId", currentProject.getArtifactId() );
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        p.store( out, "Generated by org.apache.felix.bundleplugin" );
        jar.putResource( path + "/pom.properties", new EmbeddedResource( out.toByteArray(), System.currentTimeMillis() ) );
    }


    protected Jar[] getClasspath( MavenProject currentProject ) throws IOException, MojoExecutionException
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.