X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fimagesqueeze%2Fcodec%2FBitInputStream.java;fp=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fimagesqueeze%2Fcodec%2FBitInputStream.java;h=0000000000000000000000000000000000000000;hp=b5ba69a128853c7548dccb1934577108ef4a22ee;hb=4bcffe8896c08c9f60b2707da71bb39a64618d93;hpb=c7d0b8e1723045c0df086d9214a35f54db47684c diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitInputStream.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitInputStream.java deleted file mode 100755 index b5ba69a..0000000 --- a/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitInputStream.java +++ /dev/null @@ -1,56 +0,0 @@ -package eu.svjatoslav.imagesqueeze.codec; - -/** - * Read individual bits from the input stream. - */ - -import java.io.IOException; -import java.io.InputStream; - -public class BitInputStream { - - - int currentByte; - int currentBytePointer = -1; - - InputStream inputStream; - - public BitInputStream(InputStream inputStream){ - this.inputStream = inputStream; - } - - public int readBits(int bitCount) throws IOException { - - int readableByte = 0; - for (int i=0; i < bitCount; i++){ - - readableByte = readableByte << 1; - - if (currentBytePointer == -1){ - currentBytePointer = 7; - currentByte = inputStream.read(); - } - - int mask = 1; - mask = mask << currentBytePointer; - - int currentBit = currentByte & mask; - - if (currentBit != 0){ - readableByte = readableByte | 1; - } - - currentBytePointer--; - } - return readableByte; - } - - public int readIntegerCompressed8() throws IOException{ - if (readBits(1) == 0){ - return readBits(8); - } else { - return readBits(32); - } - } - -}