Variable entries in property file

F

frank

Variable entries in property file

I was wondering is there a good way to setup and read in variable
entries in a property file? I wasn’t to have from 1-many Ip/port value
pairs but won’t know in the program how many their might be

Example:
Ip1=128.1.1.1
Por1t=2001
Ip2=128.1.1.2
Port2=2002
Ip3=128.1.1.3
Port3=2001


Thanks,

Frank
 
L

Lucy

frank said:
Variable entries in property file

I was wondering is there a good way to setup and read in variable
entries in a property file? I wasn’t to have from 1-many Ip/port value
pairs but won’t know in the program how many their might be

Example:
Ip1=128.1.1.1
Por1t=2001
Ip2=128.1.1.2
Port2=2002
Ip3=128.1.1.3
Port3=2001


Thanks,

Frank
I think there is something like "load" that will put all that is there into
an array for you.
 
J

Johan Poppe

Lucy said:
....
I think there is something like "load" that will put all that is there into
an array for you.

You are thinking of java.util.Properties. It is basically a HashMap
with "load" and "save" methods to read and write property files, and
should do the job for the original poster.
 
D

Dale King

Johan said:
You are thinking of java.util.Properties. It is basically a HashMap
with "load" and "save" methods to read and write property files, and
should do the job for the original poster.

Actually it is a subclass of Hashtable. It is a very good example of
inappropriate use of inheritance when containment was the better answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top