I have a program in Java that needs to write a file with integers of 8, 16, 32 and 64 bits and floating point numbers of 16, 32 and 64 bits. This file needs to be read by a program in C (and vice-versa). These programs are used in different type of machines, so the file needs to be independent of little or big endian.
I am looking for a library in Java and in C for doing this. The library needs to be compact, because this will be used also in a micro-controller.
note: At the moment, I am implementing the functions myself, and it works fine (so, no need to give me an ad-hoc solution). note: I am aware that I could write the numbers in a human readable format, and use scanf to read them; I prefer not to use this solution now, because it is slower and takes more place.