8

Preon is a Java library meant for creating binary codecs: you simply place annotations in a class' data members regarding their correspondence with bit fields (e.g. number of bits to use for certain field) and, based on such class, the library builds a Codec object that is able to create instances of the class reading their data from a binary input stream.

Due to licensing issues (it is distributed under GPL), I cannot use it.

Are there any libraries with equivalent or similar functionality, either in Java or in C++?

noe
  • 1,684
  • 1
  • 17
  • 35
  • Can’t you use precompiled GPL-licensed libraries by referencing them as jar files without being contaminated by the license? I always thought that dynamic linking (which this amounts to) was allowed under the GPL (unlike static linking). This might be outdated information, though. – Konrad Rudolph Jul 14 '11 at 19:48
  • 1
    the general consensus i've seen is that you _can't_ use GPL java libraries without your code also being GPL. granted, this is where the GPL gets a little nebulous. LGPL and "GPL with classpath exception" is generally considered safe (see my answer). – jtahlborn Jul 14 '11 at 20:01
  • 1
    jthahlborn is completely right. Other than, you *can* also get a commercial license for Preon. – Wilfred Springer Jul 19 '11 at 18:28
  • @WilfredSpringer How can I get a commercial license for Preon? – Dirk Jäckel Jan 20 '14 at 15:59
  • Dirk Jäckel, contact me (wilfredspringer at gmail dot com) – Wilfred Springer Jun 20 '14 at 14:55
  • link is dead (well, it requires authentication) – bvdb Sep 22 '15 at 13:49
  • Link fixed, now pointing to preon's github repository – noe Sep 22 '15 at 20:36

2 Answers2

10

looking at the license page, the preon library is "GNU General Public License, version 2, with the Classpath Exception", which is important. that allows you to use the library in binary form without your application also being GPL.

jtahlborn
  • 52,909
  • 5
  • 76
  • 118
  • Reading the license I get the impression that I'd have to check every source file of Preon whether it contains the classpath exception. Did you check that every file does? Or am I wrong? – Dirk Jäckel Jan 20 '14 at 16:17
  • @DirkJäckel - nope, i didn't check every file. i was not the one planning on using the library. – jtahlborn Jan 20 '14 at 16:24
  • 3
    The license has been changed to MIT, which is much more permissive. – Wilfred Springer Apr 05 '17 at 13:18
0

Take a look at Java Binary Block Parser library, it allows to make bit field parsing and mapping to class fields

Igor Maznitsa
  • 833
  • 7
  • 12