Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30574
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Robert Klemme <shortcutter@googlemail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Reading a properties file so that keys can be retrieved in order |
| Date | Tue, 16 Dec 2014 13:14:11 +0100 |
| Lines | 35 |
| Message-ID | <cfam0mFc8d5U1@mid.individual.net> (permalink) |
| References | <c12651b9-38b4-4604-9084-4bfd2aa0ba86@v31g2000vbs.googlegroups.com> <ff033a1b-8b72-4292-b12a-90d868bf43a7@googlegroups.com> <548b8203$0$294$14726298@news.sunsite.dk> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | individual.net vfbrdOKZElAcWxhI05gcRQqnCzN9fM8/7UYi/qvnLKlkp5QVg= |
| Cancel-Lock | sha1:TdH/6raPPKGss5Krl8PG0DWPXnA= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
| In-Reply-To | <548b8203$0$294$14726298@news.sunsite.dk> |
| Xref | csiph.com comp.lang.java.programmer:30574 |
Show key headers only | View raw
On 13.12.2014 01:02, Arne Vajhøj wrote:
> On 12/12/2014 11:40 AM, etienne.studer@gradleware.com wrote:
>> OrderedProperties properties = new OrderedProperties();
>> properties.load(new FileInputStream(new File("~/some.properties")));
The input stream is not properly closed as far as I can see.
>> The OrderedProperties class will solve your requirement.
>
> The question is 3.5 years old.
Maybe it took him so long...
I am more concerned with the usefulness of this approach. Properties
are simply unordered and I think no special semantic should be applied
to that order. This is fragile. If order is needed it is much better
to choose property names accordingly and this is also what most people
seem to do.
foo.bar.name.2=World
foo.bar.name.1=Hello
foo.bar.name.3=!
If it gets fancier than that then maybe properties are not the proper tool.
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Reading a properties file so that keys can be retrieved in order etienne.studer@gradleware.com - 2014-12-12 08:40 -0800
Re: Reading a properties file so that keys can be retrieved in order Arne Vajhøj <arne@vajhoej.dk> - 2014-12-12 19:02 -0500
Re: Reading a properties file so that keys can be retrieved in order Robert Klemme <shortcutter@googlemail.com> - 2014-12-16 13:14 +0100
csiph-web