Giter Site home page Giter Site logo

definite / openprops Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zanata/openprops

0.0 2.0 0.0 144 KB

A fork of java.util.Properties from OpenJDK which preserves comments and the order of entries

Home Page: https://fedorahosted.org/openprops/

License: GNU General Public License v2.0

Shell 0.04% Java 99.96%

openprops's Introduction

OpenProps
https://github.com/zanata/openprops/

OpenProps is a tiny Java library which reads and writes .properties files 
using the same code as java.util.Properties from the OpenJDK, but enhanced so
that it preserves the order of entries within the file, and it also preserves
comments in the file.  This means that a Properties editor or a file converter written to use 
OpenProps won't have to lose comments or mess up the order of entries. 

By using OpenJDK code, OpenProps should handle all the old corner-cases in 
exactly the same way Java does.  The handling of whitespace and comments is
tested by a number of JUnit tests.  But please let me know if you find a bug!

Note the following differences from java.util.Properties:

1. preserves comments and the order of entries in the file
2. storeToXml doesn't use the Sun DTD (or any DTD) because it adds attributes for comments.
3. equals() and hashCode() won't work the same way as with java.util.Properties, because
   they are no longer inherited from Hashtable.  All you get is identity equality/hashcode.

Also note that any header comment in the .properties file will be interpreted as
a comment attached to the first message.

- Sean Flanigan <[email protected]>


Licence:

OpenProps is based on the OpenJDK source code for java.util.Properties, 
and uses the same licence: GPLv2 + Classpath Exception. 
(Specifically, Properties.java and XMLUtil.java are taken from
 java-1.6.0-openjdk-1.6.0.0-0.16.b09.fc9.src.rpm in Fedora 9.)


Source code notes:

The original versions of java.util.Properties and the helper class 
java.util.XMLUtils are in the "orig" directory, for reference in 
generating patches.

If you are wondering why OpenProps isn't just a patch to java.util.Properties, 
submitted for inclusion in the OpenJDK, it's because java.util.Properties 
extends Hashtable, and thus can't cleanly use another implementation (such as 
LinkedHashMap) without breaking an established Java API.  

Changelog
* Tue Sep 16 2008 Sean Flanigan <[email protected]>
- Initial release based on OpenJDK 1.6.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.