@Chrisir,
if you want to store multiple "bit-groups" in file, it's important to figure out how are you gonna use them? Are you gonna just generate them once (before you deploy the sketch)? And then only read them?
Or are you going to update their values after every run of the sketch?
And if you're going to update them:
are you ONLY (meaning that once you decide on size, it NEVER changes throughout the normal usage scenarios of your sketch) going to change values of the bits arrays (meaning never shrinking or expanding array, but just flipping bits)?
or are you going to change dimensions of arrays as well?
What are going to be the average size of one array? What's going to be the size of all arrays you will use? Will all the arrays need to stay in memory all the time?
What platforms? Are you only staying in Java Desktop mode? or are you to use Android? (I guess we dumpted good'ol JavaScript when we started considering BitSet class as potential option).
Honestly, if working with processsing, I would for simplicity just store 1 array per file. If you try to implement it "faster" via RandomAccessFile
, you just see (from the questions I have above) how much harder it becomes and it looses flexibility.
IMHO I would stay with the simpliest way- one array per file.
ps. Or if anyone else knows quick and simple way to implement it, I would be delighted to learn myself as well (because I often tend to think complicated solutions).