Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java properties - slash inserted before colon when written out

Posted on 2003-10-31
6
Medium Priority
?
1,684 Views
Last Modified: 2008-01-16
I have a properties file that contains property/value pairs as follows:

propertya = :vala:valb:valc:

I simply read this into a properties object and write it back out to a new properties file. The new properties file would have written out this property as follows:

propertya = \:vala\:valb\:valc\:

Can anyone tell me why this happens?  and what I can do to prevent it from happening?   I am constrained to the current format of the initial properties file.

Thanks!
0
Comment
Question by:pauldoc
6 Comments
 
LVL 8

Expert Comment

by:_corey_
ID: 9659130
Could you post the snippet of writing to the file?
0
 

Author Comment

by:pauldoc
ID: 9659208
Actually,  I just looked closer at the javadoc for the properties class.  The store method has the following comment included:

"The key and value characters #, !, =, and : are written with a preceding slash to ensure that they are properly loaded. "

I guess there may not be a simple solution to this.

As for a code snippet - not much to it: I create a file output stream in one section of code and then pass that into the method where I write to the new file:

 properties.store(propOutStream,"Properties");
0
 

Accepted Solution

by:
n_sidhaye earned 300 total points
ID: 9663555
 Ok I got your point.you can replace : to - or other specific character which will not be special character after reading property you can replace the specific character by replace method.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Loops Section Overview

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question