File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read .properties file

 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you read your properties file?
- java.util.Properties.load(java.io.Reader) ?
- just usual file read line by line?
 
Roel De Nijs
Sheriff
Posts: 9105
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you read and parse a properties file yourself, if you have an API (class) available which does this work for you. No need to reinvent the wheel!
 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because reading couple lines of text is very simple wheel to reinvent ;) ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pawel Pawlowicz wrote:Because reading couple lines of text is very simple wheel to reinvent ;) ?


Worst. Reason. Ever.
 
Roel De Nijs
Sheriff
Posts: 9105
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not only a bad reason, it might (and probably will) result in point loss (not using/ knowing the Java API).
 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Pawel Pawlowicz wrote:Because reading couple lines of text is very simple wheel to reinvent ;) ?


Worst. Reason. Ever.
Yes, I could agree that this is a bad reason. But Worst. Reason. Ever.? That I don't get.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Because I can" is the worst possible reason to not use the existing API.
 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:"Because I can" is the worst possible reason to not use the existing API.
If you put it that way, I completely agree .
 
Paul Clapham
Sheriff
Pie
Posts: 20171
24
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reason: because somebody might read about all of the strange ways to put data into a properties file, and then find out the hard way that your quick and dirty properties file parser didn't bother to implement all of those features.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic