A simple user-friendly library to perform bits manipulations in java. You might find this useful if you're implementing compression/encryption algorithms.
You can include the latest version of bits4j in your maven project adding the following dependency tag:
<dependency>
<groupId>io.github.fdero</groupId>
<artifactId>bits4j</artifactId>
<version>LATEST</version>
</dependency>- This library comes with the
BitValueenum, wich has two values,BitValue.ZEROandBitValue.ONE. - You can create a
BitList(an efficient implementation ofList<BitValue>) to store them. - You can use
BitListConversionsto convert betweenbyte,int,long,StringandBitList. - The
BitReaderis a wrapper aroundInputStreamthat allows the user to read bit by bit. - The
BitWriteris a wrapper aroundOutputStreamthat allows the user to write bit by bit. - The
flushmethod ofBitWriterignores the last bits if they are not part of a byte. - The
BitWriterhas aaddPaddingmethod that adds zeros to complete the byte. - The
BitListInputStreamit's an implementation ofInputStreamthat reads from aList<BitValue>. - The
BitListOutputStreamit's an implementation ofOutputStreamthat writes toList<BitValue>.