Redian新闻
>
请问java property file的问题
avatar
请问java property file的问题# Java - 爪哇娇娃
t*g
1
Suppose I have two fields source and genre. source can have thousands of
values. I want to read the values in. genre can have 10 values. The values
of the two fields will be changed from time to time. What's the most
convinient way to store and retrieve the values? No database is available.
Initially I planned to use Java property files to store them. But it appears
Java Properties class can retrieve multiple values for the same key. Do I
have to go with the most basic file processing?
avatar
g*g
2
How about a map?

appears

【在 t*g 的大作中提到】
: Suppose I have two fields source and genre. source can have thousands of
: values. I want to read the values in. genre can have 10 values. The values
: of the two fields will be changed from time to time. What's the most
: convinient way to store and retrieve the values? No database is available.
: Initially I planned to use Java property files to store them. But it appears
: Java Properties class can retrieve multiple values for the same key. Do I
: have to go with the most basic file processing?

avatar
t*g
3
No, I'm asking about how to physically store the data. Now I created a file
with thousands of values.

【在 g*****g 的大作中提到】
: How about a map?
:
: appears

avatar
s*e
4
XML文件呢?
或者还是用property file, 把Value的各个值用分隔符分开,但是放在一行

file

【在 t*g 的大作中提到】
: No, I'm asking about how to physically store the data. Now I created a file
: with thousands of values.

avatar
g*g
5
The most convenient way would be just serializing your data
if you are using it with Java only. All you need to do is
keep your data in a bean class and mark it serializable

file

【在 t*g 的大作中提到】
: No, I'm asking about how to physically store the data. Now I created a file
: with thousands of values.

avatar
t*g
6
This is a file that will be manually maintained. So I went with the most
simple file operation to read the file and get the values. I didn't use xml
file format so the users don't have to struggle to create a one thousand
lines xml file. All they need to copy and paste the values into the file,
one value per line. The format is consistent with the source of the values.
Problem is resolved. Thank everyone.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。