Wednesday, April 25, 2001 08:46 AM
Wow, that sounds enormously inefficient.BitSet
is really only meant for manipulating
a small number of bits as boolean values.
There is no way to get the value of more
than one bit at a time, and even with the one
bit you only get a boolean.
I suggest if you want to use a bit-set-like functionality,
you write your own class to do it. Bit manipulation in
Java is straightforward using shifts, bit masks, bitwise
ands and ors, etc. And it will be much more efficient
that using BitSet for this purpose.
Also, I suggest you make your compression classes
follow the examples set by java.util.jar and
java.util.zip, that way their usage is consistent
with the existing Java classes. (Check the source code
for those package to see how Sun does it!).