I have to read a binary file in a legacy format with Java.
In a nutshell the file has a header consisting of several integers, bytes and fixed-length char arrays, f
If you would be using Preon, then all you would have to do is this:
public class Header {
@BoundNumber int version;
@BoundNumber byte type;
@BoundNumber int beginOfData;
@BoundString(size="15") String id;
}
Once you have this, you create Codec using a single line:
Codec codec = Codecs.create(Header.class);
And you use the Codec like this:
Header header = Codecs.decode(codec, file);