aspose file tools
The moose likes Java in General and the fly likes Reading Properties file with spaces in key Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Reading Properties file with spaces in key" Watch "Reading Properties file with spaces in key" New topic
Author

Reading Properties file with spaces in key

Jeffrey Pony
Greenhorn

Joined: Jun 24, 2002
Posts: 25
Iam currently using jdk1.4.
I have a to read a properties file containing text,

key = value
spaced key = spaced value


Can I set the delimiter that is to be used by Properties, in this case I would want only '=' as the delimiter and ignore whilte space between the keys.

Is there any way that I can acheive this in my code while creating the Properties object or invoking the load method?

Is there any alternate way of reading the key and value?

Thanks in advance.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8290

Jeffrey, please do not post the same question in multiple forums. We all read multiple forums so you are not increasing your audiance. It can also cause the community to duplicate effort as we try to answer every question. We're all volunteers here. It may take more than 17 minutes for someone to get around to your question. Please be patient.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Jeffrey Pony
Greenhorn

Joined: Jun 24, 2002
Posts: 25
oops, did not intend to cause any extra work.
Shall remember that.

The way I am currently handling it is, that I am treating the file as just another file.

Reading the file using,
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));

and then performing String manipulation to get the key and value.

Would be interesting to know if it can be acheived by the Properties class without overriding the load method. Is there any way to do it using the API.

Thanks.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Reading Properties file with spaces in key
 
Similar Threads
Storing key-value pairs: Better apporaches for storing and reading?
read a .txt file from classpath
reading properties file
Default Language Properties file
save properties file without affecting existing comments.