Re: File IO -- Reading Config Files Easily



"Hal Vaughan" <hal@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:uZOdnUZ04oZ4v7HZRVn-ig@xxxxxxxxxxxxxx
I remember somewhere I saw a Java program that had a config file with
name/value pairs like:

alpha=one
beta=two
gamma=three

The programmer was using something in the Java API to easily read this in
and use the value pairs for setting variables, or maybe for setting values
in something like a HashMap or Vector. I can't remember what he used or
what it was called, but it was a basic shortcut from having to read the
file line by line, split each line on the "=", and parse the results.

Any help on what would do this or what to call it?

It's the Properties class - more information and sample code can be found in
the following link.

http://jcsnippets.atspace.com/java/input-output/store-program-settings.html

Best regards,

JC
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks


.



Relevant Pages

  • Re: Who is responsible for refreshing the UI?
    ... Now I am no VB programmer so I am not sure if I wrote my sample code ... I am calling Yield() in my ATL OCX but that does not seem to ...
    (microsoft.public.vc.atl)
  • Re: Editing recorded TV files
    ... I'm not a programmer so have no idea how to go about using this. ... > The DVR-MS Sample Code also includes a DVR-MS editor. ... >> Just a basic editing program to remove those pesky commercials. ... >>> editing software needs to be able to be able to convert this sort of format ...
    (microsoft.public.windows.mediacenter)
  • Re: File IO -- Reading Config Files Easily
    ... The programmer was using something in the Java API to easily read this in ... pairs in XML format, not in plain text. ... Monique Mudama ...
    (comp.lang.java.help)
  • Re: Code curosity
    ... >> much higher level instructions that the programmer wrote ... The problem with sample code from a vendor is that it's often pedantic ... to the point of mania about a single topic that it's trying to ... "Are You Berry Berry Happy?" ...
    (comp.sys.mac.system)
  • Re: How to use iconv() from C?
    ... Thanks a lot for your sample code. ... The following code is longer and might not look that elegant but it ... tells the programmer what the values are used for. ... See if using regular iconv_openwill ...
    (comp.sys.ibm.as400.misc)