• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to add key-value dynamically by using Properties Object

 
Garg Naresh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,I am trying add some properties dynamically by using Properties object.
Properties prop = new Properties();
try {
prop.load(new FileInputStream("C:/test.properties"));
} catch (Exception exp) {
System.out.println(exp);
}

prop.setProperty("1", "l'historique antal �rs");
prop.setProperty("2", "des candidats et/ou");
prop.setProperty("3", "{0} ({1}) est � la page ");
prop.setProperty("4","<b>Manuel :</b> l'historique antal �rs ntrez ousmmmmmmmmmmmmmmmmmmmmmmmmmm77777777777777777777777777777777777123");

PrintWriter out = new PrintWriter( new FileWriter ( "C:/test.properties"),true);
out.store(out);

When i open test.properties file ..i found it some value are omitted after some length.. means ..vlaue of 4 is print dot dot after some length.
4=<b>Manuel :</b> l'historique antal �r...
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Garg.
Your code will not compile under JDK 1.5.0 because there's no Properties.store method that takes a PrintWriter.
I changed it to use a FileOutputStream and it works fine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!